Jump to content
Search Community

GSAP.defaults different for FROM and TO

Remco test
Moderator Tag

Recommended Posts

Hi all! 

 

I love to set some defaults at the start of my project, like the default duration and ease. 

Is it possible to set defaults specific for FROM or TO animations?

 

Something like this:

gsap.defaults({
                'from': {
                  ease:     'power3.in',
                  duration: 0.6
                },
                'to': {
                  ease:     'power1.out',
                  duration: 0.2
                }
              });

Any idea?

  • Like 1
Link to comment
Share on other sites

Not like that I'm afraid but you could do this...

 

It's a little more repetitive, but less so than writing out the properties every time
 

let fromdefaults = {
  some: stuff,
  some: morestuff,
}

tl.from('.elem', {
  yPercent: 200,
  ...fromDefaults
})

 

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...