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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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