Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-09-2008, 04:10 AM   #1
ryanhamilton
Registered User
 
Join Date: Feb 2008
Posts: 33
Default TweenLite parameters

Using TweenLite AS3; any way to control how much Back or Elastic easing happens. As in making a large movement of 500px and having the amount of Back ease you'd get from say a 100px movement. Same for Elastic.

thanks a ding ding
ryanhamilton is offline   Reply With Quote
Old 03-09-2008, 06:58 AM   #2
ryanhamilton
Registered User
 
Join Date: Feb 2008
Posts: 33
Default

Never mind, I didn't notice someone had asked this same question on the TweenLite site. It was buried in the comments. Here's the answer.


TweenLite doesn’t natively support passing extra parameters to the easing function because doing so would affect performance slightly. TweenLite was carefully tuned to prioritize performance and compactness over trying to be everything to everybody which would lead to “code bloat”. However, there IS a way to do what you’re talking about by simply adding your own easing function that has those parameters hard-coded, like this:
ActionScript Code:
function myCustomEaseOut (t:Number, b:Number, c:Number, d:Number):Number { var a = 1.5; //Your 1st custom variable var p = 2.45; //Your 2nd custom variable if (t==0) return b; if ((t/=d)==1) return b+c; if (a < Math.abs(c)) {var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b); } TweenLite.to(myMovie2, 1, {y:300, delay:4, ease:myCustomEaseOut, overwrite:false});
Doing it this way may seem a bit more cumbersome, but the code will perform faster, especially when you’re doing vast numbers of simultaneous tweens. It also keeps TweenLite nice and compact which makes me feel all warm and fuzzy inside.
ryanhamilton is offline   Reply With Quote
Old 03-09-2008, 11:59 PM   #3
ultraky
A flash Guy
 
Join Date: Mar 2007
Location: NYC
Posts: 79
Send a message via AIM to ultraky
Default

groovy
ultraky is offline   Reply With Quote
Old 03-27-2008, 01:28 AM   #4
greensock
Senior Member
 
greensock's Avatar
 
Join Date: Jan 2008
Location: Near Chicago
Posts: 131
Default

Actually, I figured out a way to integrate passing extra parameters without hurting performance. The good news is that TweenLite now accepts a special easeParams property which should be an array with all your extra parameters that you'd like to pass the easing equation. So you could do something like:

ActionScript Code:
TweenLite.to(myMovie2, 1, {y:300, delay:4, ease:Back.easeOut, easeParams:[1.5, 2.45], overwrite:false});

Cheers.
greensock is offline   Reply With Quote
Old 03-27-2008, 01:34 AM   #5
ultraky
A flash Guy
 
Join Date: Mar 2007
Location: NYC
Posts: 79
Send a message via AIM to ultraky
Default

groovy +1
ultraky is offline   Reply With Quote
Old 08-25-2008, 08:11 PM   #6
marfastic
Registered User
 
Join Date: Aug 2008
Posts: 2
Red face Custom Easing Tween

If you would like to make a completely custom tween for use with TweenLite I have created an app for you to do just that http://marfastic.blogspot.com/2008/0...tweenlite.html . I based it off of LMC Tween's Flash Panel which allows you to be able to edit a tween to your heart's content.
marfastic is offline   Reply With Quote
Old 08-25-2008, 08:18 PM   #7
greensock
Senior Member
 
greensock's Avatar
 
Join Date: Jan 2008
Location: Near Chicago
Posts: 131
Default

Quote:
Originally Posted by marfastic View Post
If you would like to make a completely custom tween for use with TweenLite I have created an app for you to do just that
Cool! Or try this:
http://blog.greensock.com/customease/

greensock is offline   Reply With Quote
Old 08-25-2008, 08:36 PM   #8
asf8
Senior Member
 
Join Date: Apr 2007
Posts: 3,609
Default

Quote:
Originally Posted by marfastic View Post
If you would like to make a completely custom tween for use with TweenLite I have created an app for you to do just that http://marfastic.blogspot.com/2008/0...tweenlite.html . I based it off of LMC Tween's Flash Panel which allows you to be able to edit a tween to your heart's content.
Quote:
Originally Posted by greensock View Post
@marfastic, thanks for that.

@greensock, Jack is your tool in anyway optimized further than the ones mentioned below to work more effieciently with your tween classes?

• LacoTween -- Custom Easing Tool
• FuseKit -- customEasingTool2
• Penner Easing Equations -- always an option to just modify for your needs
• Marfastic -- Create Custom Tween's for TweenLite.

I know your big on speed/optimization, but what benefits would one have using yours (donating $) verses using one of the Free ones to create custom tweens? By the way I am not discouraging people from donating, just wishing to know the benefit of your custom ease builder over the others already out there.

Thanks for any feedback!
asf8 is offline   Reply With Quote
Old 08-25-2008, 09:57 PM   #9
greensock
Senior Member
 
greensock's Avatar
 
Join Date: Jan 2008
Location: Near Chicago
Posts: 131
Default

Quote:
Originally Posted by asf8 View Post
Jack is your tool in anyway optimized further than the ones mentioned below to work more effieciently with your tween classes?
Great question. The Penner equations are probably a bit faster than any custom one because there are usually more calculations required with bezier curve values. Frankly, I'm not entirely sure if my CustomEase is better/faster than the others, but I can tell you that I tried very hard to optimize it for speed, efficiency, and ease-of-use. And I'm not sure if the other tools create equations based on the standard format (where the parameters are time, start value, change in value, and duration) - I suspect they don't. My CustomEase class could be used with virtually any tweening engine becaust it follows the standard format. Again, maybe some of the others do too, but the ones I looked at didn't. I've never tested other ones with TweenLite/TweenMax, but if they don't follow the standard format, they cannot be used (without tweaking at least).

Regarding the donations thing, I just try to find some extra ways to create value for people who support me by joining Club GreenSock, and CustomEase is one of my attempts at that. If the other custom ease tools work well for you, by all means, use them instead of mine.

I'd love to hear back as to whether or not the other tools work with TweenLite/TweenMax. I'd try 'em myself, but I'm swamped with work and have a deadline tomorrow

Thanks again, Marfastic, for creating a resource for TweenLite/TweenMax users out there!
greensock is offline   Reply With Quote
Old 08-25-2008, 11:29 PM   #10
asf8
Senior Member
 
Join Date: Apr 2007
Posts: 3,609
Default

Quote:
Originally Posted by greensock View Post
Great question. The Penner equations are probably a bit faster than any custom one because there are usually more calculations required with bezier curve values. Frankly, I'm not entirely sure if my CustomEase is better/faster than the others, but I can tell you that I tried very hard to optimize it for speed, efficiency, and ease-of-use. And I'm not sure if the other tools create equations based on the standard format (where the parameters are time, start value, change in value, and duration) - I suspect they don't. My CustomEase class could be used with virtually any tweening engine because it follows the standard format. Again, maybe some of the others do too, but the ones I looked at didn't. I've never tested other ones with TweenLite/TweenMax, but if they don't follow the standard format, they cannot be used (without tweaking at least).
Thanks for the feedback Jack, that is the type of input I was hoping for.
asf8 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing additional parameters to function listeners john100 ActionScript 3.0 20 01-27-2009 06:52 PM
Passing ...rest to a function with an undefined number of parameters rrh ActionScript 3.0 1 12-17-2007 11:06 PM
using function with parameters in parameters of functions... squadjot ActionScript 1.0 (and below) 3 08-04-2006 05:53 PM
Component parameters dynamicaly changed from begining question cYb3rc0re Components 0 02-25-2006 10:50 AM
actions and parameters as parameters Electric Dandy ActionScript 2.0 3 02-12-2006 11:36 AM


All times are GMT. The time now is 04:36 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.