Hello everyone! I am making some tweening functions but I have encountered a specific formula that I do not know how to inverse. I presume that arcsin is involved but I do not know how exactly.
What my goal is, is to invert this formula so it returns t instead of x:
x = math.sin(math.pi/2*t-math.pi/2)+1
t = ...
Does anyone know how to do this? I am not that familiar with sin so I do not know how to invert it exactly.
You can use sites like Wolfram alpha to verify this type of question. Also it is worth noting that you will be limited to values of t within a certain range due to the periodic nature of the original equation.
Here’s the steps involved in case anyone was interested.
x = math.sin(((math.pi/2)*t)-(math.pi/2))+1 --Subtract one from both sides.
x-1 = math.sin(((math.pi/2)*t)-(math.pi/2)) --Perform inverse of sine (arcsine) on both sides.
math.asin(x-1) = ((math.pi/2)*t)-(math.pi/2) --Add (math.pi/2) to both sides.
math.asin(x-1)+(math.pi/2) = (math.pi/2) * t --Divide both sides by (math.pi/2).
math.asin(x-1)*(1/(math.pi/2))+1 = t --Simplify stacked division.
math.asin(x-1)*(2/math.pi)+1 = t