Jump to content
Search Community

tween same name properties, same time

yomotsu test
Moderator Tag

Go to solution Solved by GreenSock,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi, I am trying to make with PIXI.js and three.js.

 

Display-object in those libs has following properties and names are the same like, position.x, scale.x

 

- position

- rotation

- scale

 

Is it possible that tween these on a same timeline instance?

currently the codepen demo is woking 2 separated timeline instance.

 

Thanks in advance.

See the Pen YPdXYE?editors=101 by yomotsu (@yomotsu) on CodePen

Link to comment
Share on other sites

  • Solution

Absolutely! And you don't have to use the long-hand syntax like that. I'd recommend the convenience methods. Here's a comparison:

//YOUR OLD CODE:
var timeline1 = new TimelineMax();
timeline1.append( new TweenMax( mySprite.position, 10, { x : 100 } ) );
timeline1.play();

var timeline2 = new TimelineMax();
timeline2.append( new TweenMax( mySprite.scale, 10, { x : 2 } ) );
timeline2.play();

And the revised code:

//BETTER:
var timeline1 = new TimelineMax();
timeline1.to( mySprite.position, 10, { x : 100 } );
timeline1.to( mySprite.scale, 10, { x : 2 }, 0 );

I'd highly recommend that you look at these:

http://greensock.com/position-parameter

http://greensock.com/sequence-video

 

Trust me: once you get comfortable with the API, you're gonna feel really powerful :)

 
 
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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