iwmlib/lib/pixi/volatile.html

71 lines
2.4 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
2019-03-21 09:57:27 +01:00
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2019-03-21 09:57:27 +01:00
<title>PIXI Volatile</title>
2019-03-21 09:57:27 +01:00
<link rel="stylesheet" href="../3rdparty/highlight/styles/default.css" />
<link rel="stylesheet" href="../../css/doctest.css" />
2019-03-21 09:57:27 +01:00
<script src="../3rdparty/highlight/highlight.pack.js"></script>
<script src="../../dist/iwmlib.3rdparty.js"></script>
2019-03-21 09:57:27 +01:00
<script src="../../dist/iwmlib.js"></script>
<script src="../../dist/iwmlib.pixi.js"></script>
</head>
<body onload="Doctest.run()">
<h1><a href="../index.html">lib.</a><a href="index.html">pixi.</a>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()
2019-03-21 09:57:27 +01:00
let button1 = new Button({
label: 'Volatile me!',
action: () => {
new Volatile({
object: button1,
direction: 'right',
destroyOnComplete: false
})
}
})
2019-03-21 09:57:27 +01:00
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
})
}
})
2019-03-21 09:57:27 +01:00
app.scene.addChild(button1, button2)
</script>
</body>
</html>