AccelTween
Provides a means to, with both a continuous position and velocity, accelerate from its current position to a target position in minimum time given a maximum acceleration. See Spring for another version of this.
Author: TreyReynolds/AxisAngles
Functions
new
AccelTween.new(maxaccel: number?--
The maximum acceleration applied to reach its target. Defaults to 1
) → AccelTweenConstructs a new AccelTween.
local accelTween = AccelTween.new(30)
accelTween.t = 1
conn = RunService.RenderStepped:Connect(function()
print(accelTween.p)
end)
task.delay(accelTween.rtime, function()
conn:Disconnect()
end)
SetClock
Sets the clock the tween reads time from. Defaults to os.clock.
Safe to call mid-tween. The stored times are shifted onto the new clock's timebase, so the current position, velocity, and the time left all carry over exactly -- the tween neither jumps nor restarts.
GetClock
Gets the clock the tween reads time from.