Skip to content

Commit

Permalink
do not accumulate state in BackEaseInOut
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken authored and joshtynjala committed Dec 4, 2024
1 parent 1e4f2f8 commit 5f25de2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/motion/easing/Back.hx
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,23 @@ private class BackEaseInOut implements IEasing {

public function new (s:Float) {

this.s = s;
this.s = s * 1.525;

}


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);
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);

}


public function ease (t:Float, b:Float, c:Float, d:Float):Float {

if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
if ((t/=d/2) < 1) return c/2*(t*t*((s+1)*t - s)) + b;
return c/2*((t-=2)*t*((s+1)*t + s) + 2) + b;

}

Expand Down Expand Up @@ -127,4 +127,4 @@ private class BackEaseOut implements IEasing {
}


}
}

0 comments on commit 5f25de2

Please sign in to comment.