This member cannot be used in scripts, but is usable in the command bar and plugins.
AnimationTrack/TimePosition of all playing
AnimationTracks that are loaded onto the
Animator, applying the offsets to the model associated with the
Animator. For use in the command bar or by plugins only.
The deltaTime paramater determines the number of seconds to increment on the animation’s progress. Typically this function will be called in a loop to preview the length of an animation (see example).
Note that once animations have stopped playing, the model’s joints will need to be manually reset to their original positions (see example).
This function is used to simulate playback of
Animations when the game isn’t running. This allows animations to be previewed without the consequences of running the game, such as scripts executing. If the function is called whilst the game is running, or by
LocalScripts, it will return an error.
Developers designing their own custom animation editors are advised to use this function to preview animations, as it is the method the official Roblox Animation Editor plugin uses.
The amount of time in seconds animation playback is to be incremented by.
Preview Animation in Studio
This code sample includes a function that can be used to preview an Animation on a Model in Roblox Studio, without needing to run the game. It utilizes the Animator.StepAnimations function, which is the same method the official Roblox Animation Editor uses.
local RunService = game:GetService("RunService") local function studioPreviewAnimation(model, animation) -- find the AnimationController and Animator local animationController = model:FindFirstChildOfClass("Humanoid") or model:FindFirstChildOfClass("AnimationController") local animator = animationController and animationController:FindFirstChildOfClass("Animator") if not animationController or not animator then return end -- load the Animation to create an AnimationTrack local track = animationController:LoadAnimation(animation) track:Play() -- preview the animation local startTime = tick() while (tick() - startTime) < track.Length do local step = RunService.Heartbeat:wait() animator:StepAnimations(step) end -- stop the animation track:Stop(0) animator:StepAnimations(0) -- reset the joints for _, descendant in pairs(model:GetDescendants()) do if descendant:IsA("Motor6D") then local joint = descendant joint.CurrentAngle = 0 joint.Transform = CFrame.new() end end end