AnimatedSprite
A Sprite that shows frames of a sprite sheet and plays named animations of them.
Made with Instance.new("AnimatedSprite").
Properties
| Name | Type | Notes |
|---|---|---|
Animation | string | The name of the current animation. Read-only. Not saved in places. |
Columns | number | Frames to a row of the sheet. Zero fits as many as the image is wide. |
Frame | number | The frame shown, counted from 0 across each row and then down. |
FrameSize | Vector2 | The size of one frame in the sheet, in pixels. |
Playing | boolean | Whether an animation is advancing. Read-only. Not saved in places. |
SpeedScale | number | Multiplies every animation's frame rate. |
Methods
AddAnimation(name: string, frames: {number}, fps: number?, looped: boolean?): (): Adds or replaces an animation of frame numbers at a frame rate.Pause(): (): Stops advancing, keeping the frame.Play(name: string?): (): Starts an animation from its first frame, or resumes the current one.Stop(): (): Stops advancing and goes back to the animation's first frame.
Events
AnimationFinished, whose handlers get(string). Fires when an animation that does not loop ends.FrameChanged, whose handlers get(number). Fires with the new frame each time it changes.
Inherited
From Sprite: CanCollide, CanQuery, Color, FlipX, FlipY, HitboxOffset, HitboxSize, Image, OnCeiling, OnFloor, OnWall, Pivot, Pixelated, Position, RegionOffset, RegionSize, Rotation, Size, Transparency, Visible, ZIndex.
From Instance: AddTag, AncestryChanged, Archivable, AttributeChanged, Changed, ChildAdded, ChildRemoved, ClassName, ClearAllChildren, Clone, DescendantAdded, DescendantRemoving, Destroy, Destroying, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, GetDescendants, GetFullName, GetPropertyChangedSignal, GetTags, HasTag, IsA, IsAncestorOf, IsDescendantOf, IsPropertyModified, Name, Parent, QueryDescendants, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild.