StepUtils
Utility functions primarily used to bind animations into update loops of the Roblox engine.
Functions
bindToRenderStep
StepUtils.
bindToRenderStep
(
update:
(
)
→
boolean
--
should return true while it needs to update
) →
(
(
...
)
→
(
)
,
--
Connect function
(
)
→
(
)
--
Disconnect function
)
Binds the given update function to RunService.RenderStepped.
local spring = Spring.new(0)
local maid = Maid.new()
local startAnimation, maid._stopAnimation = StepUtils.bindToRenderStep(function()
local animating, position = SpringUtils.animating(spring)
print(position)
return animating
end)
spring.t = 1
startAnimation()
tip
Be sure to call the disconnect function when cleaning up, otherwise you may memory leak.
bindToStepped
StepUtils.
bindToStepped
(
update:
(
)
→
boolean
--
should return true while it needs to update
) →
(
(
...
)
→
(
)
,
--
Connect function
(
)
→
(
)
--
Disconnect function
)
Binds the given update function to RunService.Stepped. See StepUtils.bindToRenderStep for details.
tip
Be sure to call the disconnect function when cleaning up, otherwise you may memory leak.
bindToSignal
StepUtils.
bindToSignal
(
update:
(
)
→
boolean
--
should return true while it needs to update
) →
(
(
...
)
→
(
)
,
--
Connect function
(
)
→
(
)
--
Disconnect function
)
Binds an update event to a signal until the update function stops returning a truthy value.
onceAtRenderPriority
StepUtils.
onceAtRenderPriority
(
priority:
number
,
func:
function
--
Function to call
) →
function
--
Call this function to cancel call
Calls the function once at the given priority level, unless the cancel callback is invoked.
onceAtStepped
StepUtils.
onceAtStepped
(
func:
function
--
Function to call
) →
function
--
Call this function to cancel call
Invokes the function once at stepped, unless the cancel callback is called.
-- Sometimes you need to defer the execution of code to make physics happy
maid:GiveTask(StepUtils.onceAtStepped(function()
part.CFrame = CFrame.new(0, 0, )
end))
onceAtRenderStepped
StepUtils.
onceAtRenderStepped
(
func:
function
--
Function to call
) →
function
--
Call this function to cancel call
Invokes the function once at renderstepped, unless the cancel callback is called.
onceAtEvent
StepUtils.
onceAtEvent
(
func:
function
--
Function to call
) →
function
--
Call this function to cancel call
Invokes the function once at the given event, unless the cancel callback is called.