Jump to content
GreenSock

gareth

Default ease for timeline?

Recommended Posts

is this possible to change the default ease just for one timeline? I tried: 

var researchTl = new TimelineMax({repeat:-1,defaultEase:Elastic.easeOut});
Link to comment
Share on other sites

Sorry, that isn't possible currently

Link to comment
Share on other sites

  • 1 year later...

Just following up on this question, is this possible to set yet or do I do it at individual tweens within the timeline.

Link to comment
Share on other sites

You can't set an ease on a timeline, but you can set a default ease like this:

TweenLite.defaultEase = Linear.easeNone;

 

That new ease will be used for all the tweens created after it, but you can override it on any tween by setting a different ease for that particular tween.

 

Happy tweening.

:)

  • Like 3
Link to comment
Share on other sites

If you use functions to create your animations, it's much easier to swap out and test different values, like an ease.

var tl = createSomeTimeline(Power1.easeInOut);

function createSomeTimeline(ease) {
  return new TimelineMax()
    .to(foo, 1, { x: 100, ease: ease })
    .to(bar, 1, { x: 100, ease: ease })
    .to(baz, 1, { x: 100, ease: ease });
}

 

  • Like 3
Link to comment
Share on other sites

Sure... if you wanna get all fancy with it. :D

  • Haha 2
Link to comment
Share on other sites

Nah, fancy would be using ES6 shorthand so it could be written like this. ;)

 

var tl = createSomeTimeline(Power1.easeInOut);

function createSomeTimeline(ease) {
  return new TimelineMax()
    .to(foo, 1, { x: 100, ease })
    .to(bar, 1, { x: 100, ease })
    .to(baz, 1, { x: 100, ease });
}

 

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