I am trying to make a nice number tween service. Like so.
for a=from,to do set.Rotation=from+1 wait() end
I want to be able to have the number start slowly, speed up, and slow down before stopping.
I like the curve but I want to be able to start with a custom number, curve, and stop at the final number in a transition.
My brain hurts after attempting to Google this question.
Like this..
Where a would be the value to loop set the rotation of the gui? and (0,from) would be the start and (1,to) would be the end.
What you're asking for is indeed a sine wave. sin(x) starts at 0, accelerates up to half the square root of 2 and then decelerates up to 1 over the domain of pi/2 radians (90 degrees).
The simplest solution is to use sin(x) from 0 to 90 degrees as a multiplier to tween from a to b.
Say the gui is rotated 45 degrees and you want it to go to 90:
local from=45 local to=90 local sin,rad=math.sin,math.rad for i = 0, 90 do set.Rotation = from + sin(rad(i))*(to - from) wait() end