Game Development Reference
In-Depth Information
The animation rate
As the sandbox is responsible for updating animations within the
Sandbox_Update
loop, it is also responsible for how fast the animation is playing; this is also known as the
animation rate. Simply multiplying the
deltaTimeInMillis
time with a rate value will
increase or decrease the animation's playback speed. We can also use negative values for
the rate to have the animation play backward:
Sandbox.lua
:
function Sandbox_Update(sandbox, deltaTimeInMillis)
if (idleAnimation) then
local rate = 2;
Animation.StepAnimation(
idleAnimation, deltaTimeInMillis * rate);
end
...
end