Jump to content
Search Community

Keyframes: is work with fromTo?

belyanskii test
Moderator Tag

Recommended Posts

Hi guys!

I have a little problem with keyframes :)

There is nothing about them in the documentation >__<

 

My question is, can i work with keyframes in from and fromTo and how it possible?

And can I use 'position' parameter?

 

The goal is to describe this behavior in keyframes:

tlBg.fromTo('.background', { scale: 4 }, { scale: 1.8, duration: 5 });
tlBg.fromTo('.background', { scale: 4 }, { scale: 1.8, y: -70, duration: 0.5 }, '-=0.2');
tlBg.fromTo('.background', { scale: 1.8, y: -70 }, { scale: 1.8, y: 70, duration: 4 });
tlBg.fromTo('.background', { scale: 5 }, { scale: 1.8, y: 70, duration: 0.5 }, '-=0.3');
tlBg.fromTo('.background', { scale: 1.8, y: 70 }, { scale: 1.8, y: -70, duration: 4 });
tlBg.fromTo('.background', { scale: 4 }, { scale: 1.8, duration: 5 }, '-=0.1');

 

Or this is fine and in future i need to do waterfalls like this? :)

Link to comment
Share on other sites

Keyframes look like this. I don't think you would use keyframes for the from values though. To position the keyframes, use delay.

 

gsap.to(".class", {keyframes: [ //<-- an array of keyframes!
  {x:100, duration:1},
  {y:200, duration:1, delay:0.5}, //create a 0.5 second gap
  {rotation:360, duration:2, delay:-0.25} //overlap by 0.25 seconds
]});

 

  • Like 1
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...