Hi all,
Here is an ease class that exactly replicates the Flash IDE classic tween easing (where you can enter a value in the range -100..100 for a timeline ease).
A customer of mine wanted to be able to use the values he always worked with so I replicated the ease function used in the Flash IDE.
Use it as you like. Create a file for the code and place it in com.greensock.easing.
Usage example :
TweenLite.to(mc, 2, {x:100, ease:ClassicEase.ease, easeParams:[50]});
This will tween the mc.x property to 100 with an classic tween ease of value 50.
package com.greensock.easing
{
/**
* Class containing ease function that replicates the classic tween ease of the flash IDE
* Can be used by TweenLite/TweenMax etc
* Usage example:
* TweenLite.to(mc, 2, {x:100, ease:ClassicEase.ease, easeParams:[50]});
* @version 1.0
* @author Reinier Feijen
*/
public class ClassicEase
{
/**
* Ease function that replicates the classic tween ease of the flash IDE
* Can be used by TweenLite/TweenMax etc
* @param t elapsed time of tween
* @param b duration of tween
* @param c min output value, at t=0
* @param d total offset (max output value minus b, at t=d)
* @param v classic ease value in range [-100,100] where a value < 0 is easeIn and value > 0 is easeOut. Larger values are also valid!
* @return output value in range [b..(b+c)]
*/
static public function ease(t:Number, b:Number, c:Number, d:Number, v:Number=0):Number
{
if (v >= 0) return b + c * (1 - Math.pow((1 - t/d), 1 + Math.abs(v / 100) ));
return b + c * (Math.pow(t/d, 1 + Math.abs(v / 100) ));
}
}
}
Best,
Reinier