- Home /
Custom Easing Types using Curves for Motion?
Hello, I would like to make a function which if given the Startpoint, Current Position & End Point will give me back the speed I should be travelling at (or a co-efficient) for easing motion.
If possible, I would like to know how to do you define such an easetype curve similar to an animation curve GUI that we get in the Inspector.
Or can I just get it through iTween? Like say I specify a percentage of distance travelled and it will return the current speed-coefficent/multiplier I should be using?
Thank you :)
Answer by AlucardJay · Aug 27, 2012 at 12:51 PM
It sounds like what you want is animation curves :
http://docs.unity3d.com/Documentation/ScriptReference/AnimationCurve.html
http://docs.unity3d.com/Documentation/ScriptReference/AnimationCurve.Evaluate.html
Hey thanks! I DID look through this. But the Evaluate function didn't really come off as something relevant. I was expecting something like GetX, GetY or GetValue :S Cheers.
Hi, I have answered other questions on curves with more information than just these links if you are curious :
http://answers.unity3d.com/questions/320689/derive-an-equation-from-a-graph.html
http://answers.unity3d.com/questions/326824/animationcurve-how-can-i-know-when-the-end-of-the.html
Answer by dentedpixel · Dec 03, 2012 at 03:23 PM
LeanTween supports Animation Curves allowing you to have a custom tween. You can define the curve type you would like by exposing an AnimationCurve property in the inspector, and then pass this to the LeanTween engine to tween any property you would like.
It can be downloaded here: http://u3d.as/content/dented-pixel/lean-tween/31i
It is also much faster than competing tweening engines like iTween, making it ideal for mobile games (or any time performance is an issue). In case you are interested here are speed comparison results: http://dentedpixel.com/developer-diary/leantween-speed-comparison-to-itween/
Answer by Dasherz · Aug 27, 2012 at 11:25 AM
Yeh I came here to say if you are making plenty of different things like this then you should learn how to use the itween code it's really simple.
Actually, we are using iTween for all predefined motion. I just want to make a function for things I cannot use iTween for to get the kind of easing curves I want. (for eg. For something like calculating the falloff)