Jump to content
GreenSock

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

Feature Request: Combining ease types

Recommended Posts

I think it would be neat if you could pass multiple ease types to TweenMax.to, something like:

 

mc.x = mc.y = 0;

// Example 1: Elastic ease in to 150:150 over 1.5 seconds...
// ...followed by Strong ease out to 300:300 over 1.5 seconds
TweenMax.to(mc, 3, {x:300, y:300, ease:[Elastic.easeIn, Strong.easeOut]});


// Example 2: Strong ease in to 150:150 over 1.5 seconds...
// ...followed by Strong ease out to 300:300 over 1.5 seconds
TweenMax.to(mc, 3, {x:300, y:300, ease:[strong.easeOut, Strong.easeIn]});


// Example 3: Strong ease in to 100:100 over 1 second...
// ...followed by Linear ease to 200:200 over 1 second...
// ...followed by Strong ease out to 300:300 over 1 second
TweenMax.to(mc, 3, {x:300, y:300, ease:[strong.easeIn, Linear.easeInOut, Strong.easeOut]});


Link to post
Share on other sites

I see what you're saying, but all of those things could easily be accomplished with 2 tweens already. Trying to combine them into one tween and adding extra parsing for a new syntax would actually have a pretty significant performance impact. Extra conditional logic would need to run on EVERY update of every tween. Plus it's creating another array for each tween (more memory) and I'm sure I'd start getting requests like "what if I don't want the easing to be cut into equal parts - what if I want the first ease to use 25% of the tween and the other 75%?" These little feature tweaks can quickly grow out of hand :) I do appreciate the suggestion, though - please keep 'em coming.

Link to post
Share on other sites

I was thinking the call would parse the array into the separate .to calls (like you said can already be done) rather than store the array and have conditional logic on every frame. But I see what you're saying, regarding the need for more customizability.

 

What if it there was instead a way to store presets, something like:

 

// Create a custom ease
var customEase:Array = []
// Start by Strong.easeOut animating 60% of the way over 1/4 the duration
customEase.push({ease:Strong.easeOut, start:0, end:.6, duration:.25})
// Next, animate back to 40% of the way over 1/2 of the duration
customEase.push({ease:Regular.easeNone, start:.6, end:.4, duration:.5})
// Finish by Strong.easeIn animating to 100% of the way over 1/4 the duration
customEase.push({ease:Strong.easeIn, start:.4, end:1, duration:.25})

/*
  Standard TweenMax.to call, but with the customEase applied.
  the to() method detects the custom ease, and parses it into separate TweenMax.to calls by
  applying the multipliers to the duration and target values.
*/
TweenMax.to(mc, 2, {x:300,y:300,ease:customEase}
/*
Parses to (assuming x & y start at 0):
TweenMax.to(mc, .5, {x:180,y:180,ease:Strong.easeOut}
TweenMax.to(mc, 1, {x:120,y:120,ease:Regular.easeNone, delay:0.5}
TweenMax.to(mc, .5, {x:300,y:300,ease:Strong.easeIn, delay:1.5}
*/

Link to post
Share on other sites

Sure, you could already accomplish that sort of thing in either of these two ways:

 

1) Just build a function that parses your logic and separates things into the various necessary tweens and maybe even wraps them in a TimelineLite and spits it back, making the whole thing easily controllable as a group.

 

- or -

 

2) Building your own custom easing equation that implements your logic. This will be slightly easier in the upcoming v12 release because eases are instances of a common "Ease" class, so you could extend that and then bake your logic in there.

 

I really don't think this feature would be appropriate to build into the core engine because not only would it complicate the API unnecessarily, but it would degrade performance and bloat file size even though you could already accomplish exactly the same functionality without any of those side effects. See what I mean?

Link to post
Share on other sites

Can't wait for v12. Sounds like the custom easing class would be a good solution.

Link to post
Share on other sites

Is there anything yet which highlights the new features/improvements of v12?

Link to post
Share on other sites

Yep, the RELEASE_NOTES.html doc that's in the AS3/AS3 v12 beta download summarizes all of the changes. If you're having trouble getting that download, just let me know. It should be in your GreenSock account (if not, scroll down and click on the banner that invites you to join the beta).

Link to post
Share on other sites

Sorry, not sure what you mean by 'be in my GreenSock account". I'm not a Club Greensock member, and am unsure where else you may be referring to.

Link to post
Share on other sites

You don't have to be a Club GreenSock member to have a GreenSock account. Just go to http://www.greensock.com/account/ to set one up. Once you log in there, you should see a banner when you scroll down a bit that invites you to join the v12 beta for AS3/AS2. Click that and you'll get access to the files. The AS3/AS2 stuff is in public beta now. And that's where you'll find that RELEASE_NOTES.html file I mentioned.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×