Composition of Easing Functions
forked from Easing function (diff: 10)
... @author 9re
ActionScript3 source code
/**
* Copyright 9re ( http://wonderfl.net/user/9re )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/tQj7
*/
// forked from 9re's Easing function
package
{
import flash.display.Sprite;
import gs.easing.*;
/**
* ...
* @author 9re
*/
public class Easing extends Sprite
{
public function Easing()
{
var sw:int = stage.stageWidth;
var sh:int = stage.stageHeight;
// draw axis
graphics.lineStyle(1, 0xff0000);
graphics.moveTo(0, sh - 150);
graphics.lineTo(sw, sh - 150);
graphics.moveTo(100, 0);
graphics.lineTo(100, sh);
graphics.lineStyle(1);
graphics.moveTo(100, sh - 180);
for (var i:int = 1; i < sw - 200; ++i)
{
graphics.lineTo(i + 100, myEasing(i, sh - 180, -sh + 250, sw - 200));
}
}
public function myEasing(t:Number, b:Number, c:Number, d:Number):Number {
if (t < d / 2) {
return Quad.easeIn(t, b, c / 2, d / 2);
} else {
return Quad.easeOut(t - d / 2, b + c / 2, c / 2, d / 2);
}
}
}
}