Jump to content

How do I use new Phaser.Tween?


Miroku_87
 Share

Recommended Posts

Hello everyone,

I would like to save a list of tweens inside an array so that I can play them later.

I've tried doing it like this:


		this.graphicTweens.push(new Phaser.Tween(this.game, this.graphicLayers[1], this.tweenManager).from( { alpha: 0 }, 1000, null, false ));
		this.graphicTweens.push(new Phaser.Tween(this.game, this.graphicLayers[2], this.tweenManager).from( {alpha: 0, x: -50, y: -5 }, 1000, Phaser.Easing.Quadratic.Out, false ));
		this.graphicTweens.push(new Phaser.Tween(this.game, this.graphicLayers[2].scale, this.tweenManager).to(  { x: scale, y: scale }, 1000, Phaser.Easing.Quadratic.Out, false ) );
		this.graphicTweens.push(new Phaser.Tween(this.game, this.graphicLayers[3], this.tweenManager).to( { x: 0 }, 1000, Phaser.Easing.Quadratic.Out, false, 500 ) );
		this.graphicTweens.push(new Phaser.Tween(this.game, this.graphicLayers[4], this.tweenManager).to( { x: 0 }, 1000, Phaser.Easing.Quadratic.Out, false, 1000 ));

And then making them start like this:


		for(var t in this.graphicTweens)
		{
			this.graphicTweens[t].start();
		}

But I get this error: 

phaser.js:65064 Uncaught TypeError: Cannot read property 'time' of undefined

What am I doing wrong?

How can I achieve this in the right way?

 

Thank you in advance!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...