65 lines
1.8 KiB
HTML
65 lines
1.8 KiB
HTML
|
<!doctype html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
|
||
|
<title>PIXI Volatile</title>
|
||
|
|
||
|
<link rel="stylesheet" href="../3rdparty/highlight/styles/default.css">
|
||
|
<link rel="stylesheet" href="../../css/doctest.css">
|
||
|
|
||
|
<script src="../3rdparty/highlight/highlight.pack.js"></script>
|
||
|
<script src="../3rdparty/all.js"></script>
|
||
|
|
||
|
<script src="../all.js"></script>
|
||
|
<script src="./all.js"></script>
|
||
|
</head>
|
||
|
<body onload="Doctest.run()">
|
||
|
<h1>Volatile</h1>
|
||
|
<p>
|
||
|
The Volatile class facilitates the "disappear" of any PixiJS DisplayObjects. Elements are "dimmed" in a predetermined direction.
|
||
|
</p>
|
||
|
<p>Let's look at some volatile examples:</p><br />
|
||
|
<canvas id="canvas" class="interactive"></canvas>
|
||
|
<p>
|
||
|
What you should see: Buttons which starts an volatile animation.
|
||
|
</p>
|
||
|
<script class="doctest">
|
||
|
const app = new PIXIApp({
|
||
|
view: canvas,
|
||
|
width: 900,
|
||
|
height: 250
|
||
|
}).setup().run()
|
||
|
|
||
|
let button1 = new Button({
|
||
|
label: 'Volatile me!',
|
||
|
action: () => {
|
||
|
new Volatile({
|
||
|
object: button1,
|
||
|
direction: 'right',
|
||
|
destroyOnComplete: false
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
|
||
|
let button2 = new Button({
|
||
|
y: 60,
|
||
|
label: 'Volatile Text',
|
||
|
action: e => {
|
||
|
let text = new PIXI.Text('Gespeichert', Object.assign({}, button2.theme.textStyleLarge, {fill: button2.theme.primaryColor}))
|
||
|
text.x = button2.width / 2
|
||
|
text.y = button2.y + (button2.height / 2) - (text.height / 2)
|
||
|
app.scene.addChild(text)
|
||
|
new Volatile({
|
||
|
object: text,
|
||
|
direction: 'right',
|
||
|
duration: 4,
|
||
|
distance: 400
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
|
||
|
app.scene.addChild(button1, button2)
|
||
|
</script>
|
||
|
</body>
|