package myspring; import javafx.animation.SimpleInterpolator; import java.lang.Math; public class SpringEquation extends SimpleInterpolator { public var amplitude:Number = 1.0; public var mass:Number = 0.035; public var stiffness:Number = 40.0; public var phase:Number = 0.0; public var pulsation:Number; init { this.pulsation = Math.sqrt(stiffness / mass); } override public function curve(t: Number) : Number { var t2 = -Math.cos(pulsation*t+phase+Math.PI) * (1-t) * amplitude ; return 1-t2; } }