Skip to main content

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(
maxaccelnumber?--

The maximum acceleration applied to reach its target. Defaults to 1

) → AccelTween

Constructs 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)
Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new AccelTween.\n\n```lua\nlocal accelTween = AccelTween.new(30)\naccelTween.t = 1\n\nconn = RunService.RenderStepped:Connect(function()\n\tprint(accelTween.p)\nend)\ntask.delay(accelTween.rtime, function()\n\tconn:Disconnect()\nend)\n```",
            "params": [
                {
                    "name": "maxaccel",
                    "desc": "The maximum acceleration applied to reach its target. Defaults to 1",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "AccelTween"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 88,
                "path": "src/acceltween/src/Shared/AccelTween.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "AccelTween",
    "desc": "Provides a means to, with both a continuous position and velocity,\naccelerate from its current position to a target position in minimum time\ngiven a maximum acceleration. See [Spring] for another version of this.\n\nAuthor: TreyReynolds/AxisAngles",
    "source": {
        "line": 10,
        "path": "src/acceltween/src/Shared/AccelTween.lua"
    }
}