Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
one2gov

transform in timeline relative to previous position

Recommended Posts

If i repeat timeline comand

tl.from(head, 0.5, {left:100});

it will repeat objects movement stating from position defined in css.

 

Is it possible to move same object several times from previous position?

 

So instead of 

tl.from(head, 0.5, {left:100}); - 100px

tl.from(head, 0.5, {left:200}); - 100px

tl.from(head, 0.5, {left:300}); - 100px

 

it would be 

tl.from(head, 0.5, {left:100}); - 100px

tl.from(head, 0.5, {left:100}); - 100px

tl.from(head, 0.5, {left:100}); - 100px

See the Pen WoGdLQ by one2gov (@one2gov) on CodePen

Link to post
Share on other sites

It's better to use x/y instead of left/top, but you can do relative movements like this...

tl.set(head, { x: 300 }) // 300
  .to(head, 0.5, { x: "-=100" }) // 200
  .to(head, 0.5, { x: "-=100" }) // 100
  .to(head, 0.5, { x: "-=100" }) // 0
  • Like 1
Link to post
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

×