Skip to content

Commit 17d166d

Browse files
committed
Create 7093 tween chain delay.js
1 parent ace5a12 commit 17d166d

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/* global colors, Phaser */
2+
3+
class Example extends Phaser.Scene
4+
{
5+
6+
preload ()
7+
{
8+
this.load.image('mySprite', 'https://labs.phaser.io/assets/particles/red.png');
9+
}
10+
11+
create ()
12+
{
13+
// const sprite = this.add.image(400, 300, 'mySprite');
14+
15+
// this.tweens.chain({
16+
// delay: 1,
17+
// tweens: [
18+
// {
19+
// targets: sprite,
20+
// x: 500
21+
// }
22+
// ]
23+
// });
24+
25+
this.objToTween = this.add.circle(this.scale.width / 2, this.scale.height / 2, 50, 0xff0000);
26+
27+
const chain = this.tweens.chain({
28+
delay: 1,
29+
tweens: [
30+
{ targets: this.objToTween, duration: 500, props: { alpha: 0 } },
31+
{ targets: this.objToTween, duration: 500, props: { alpha: 1 } },
32+
{ targets: this.objToTween, duration: 500, props: { alpha: 0 } },
33+
{ targets: this.objToTween, duration: 500, props: { alpha: 1 } },
34+
],
35+
});
36+
}
37+
}
38+
39+
const config = {
40+
type: Phaser.AUTO,
41+
parent: 'phaser-example',
42+
width: 800,
43+
height: 600,
44+
scene: Example
45+
};
46+
47+
new Phaser.Game(config);

0 commit comments

Comments
 (0)