I am trying to animate an object's position using a quadratic equation to get a Rapid-Start-Slow-Stop kind of movement.
This is already available in Delphi XE6 but I am using Delphi XE2 and Lazarus and I have created my own animation handling system which works great actually.
I already have a linear formula and a half-sinus formula, but now I want a quadratic formula.
The half-sinus formula does actually move my object rapidly at start and then slows down, but I want a more exaggerated curve, which is very rapid at start and then quickly slows down a lot and finally halts.
Unfotunately I have no code available since it is code that I am looking for.
I have used our dear friend mr Google, but no luck finding any information that I can comprehend.
Basically what is needed is a formula which gives a floating point number rangin from 0 to 1.
I then take the delta of the position of the object that needs to be moved and multiply it by the formula needed.
In my animation system I have two values regarding the animation process:
var CurrentPos, Resolution: single;
The value "CurrentPos" represents the position of the formula. For instance with Sinus I can apply "CurrentPos" as the angle, or the X axis of a plot, and "Resolution" will be the max angle (360 degrees) or the whole plot view in the X axis.
The current formula that I have found so far for the quadratic equation is the following:
formula := (-b+(Sqr(Power10(b, 2)-4*(a*c))))/(2*a);
Where in that formula do I put in the value of "CurrentPos"?
Or is the real question, have I gotten this whole mathematical process completely wrong?