For a program, stars appear at the bottom or top of the screen at a random, precalculated position. The stars travel to their predetermined destination which is the top or bottom of a letter (based on if the star originated above or below the letter). Currently the star’ motion are mostly linear, with a bit of curve from some homebrewed equation. I would like a solid parabolic equation in which the stars reach their destination position at an angle that is roughly perpendicular (+- 20 or so degrees) to the top/bottom of the destination letter. I phoned in calc 3 so I can’t figure out how to implement the parabola for this problem. I’m also open to a completely different way of animating these objects. Help appreciated. Thanks!



Extraneous info: the stars’ source position is never directly above or below the letter they are to collide with, and is never more than half the screen’s width away for the bottom-originating stars or 1/3 of the screen’s width away for the top-originating stars.
So, we want a parabola, with the apex known, as well as some other arbitrary point.
First, consider the apex. At the apex of a parabola, the first derivative of y-position is zero;
d/dx(ax^2 + bx + c) = 2ax + b, so solving forxwhen2ax + b = 0we have2ax = -b => x = -b/2a. SoX_a = -b/2a.Now, we can use this to solve for either
aorb. So,a = -b/2X_a.We also know the y-coordinate for the apex point:
Y_a = (-b/2X_a)X_a^2 + bX_a + c;Y_a = -bX_a/2 + bX_a + c;Y_a = bX_a/2 + c; solving forc:c = Y_a - bX_a/2.Now plug this in the equation for the other known point:
y = (-b/2X_2)x^2 + bx + Y_a - bX_a/2;y = -bX_a/2 + bx + Y_a - bX_a/2;y = -bX_a + bx + Y_a; solve for b:bx - bX_a = y - Y_a;b(x - X_a) = y - Y_a;b = (y - Y_a) / (x - X_a).And now you have formulas for the three parameters of a quadratic function (with
aandcdependent onb), so you can easily obtain a parametric form.