openfl / actuate

Actuate is a flexible, fast "tween" library for animations in Haxe
MIT License
158 stars 66 forks source link

BackEaseInOut doesn't work #65

Open flashultra opened 9 years ago

flashultra commented 9 years ago

BackEaseInOut not works at expected. I trying with: Actuate.tween (spriteSpin, 1, { y: 100 }).ease (Back.easeInOut); , but sprite disapear from the screen. It should work as is shown here http://greensock.com/tweenlite-as

nealR commented 7 years ago
public function calculate (k:Float):Float {

    if ((k /= 0.5) < 1) return 0.5 * (k * k * (((s *= (1.525)) + 1) * k - s));
    return 0.5 * ((k -= 2) * k * (((s *= (1.525)) + 1) * k + s) + 2);

}

Each call to calculate is further modifying the stored variable s

What it should be is...

public function new (s:Float) {

    this.s = s * 1.525;

}

public function calculate (k:Float):Float {

    if ((k /= 0.5) < 1) return 0.5 * (k * k * ((s + 1) * k - s));
    return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);

}