Skip to content

AnimatedSprite ​

A Sprite that shows frames of a sprite sheet and plays named animations of them.

Inherits Sprite → Instance.

Made with Instance.new("AnimatedSprite").

Properties ​

NameTypeNotes
AnimationstringThe name of the current animation. Read-only. Not saved in places.
ColumnsnumberFrames to a row of the sheet. Zero fits as many as the image is wide.
FramenumberThe frame shown, counted from 0 across each row and then down.
FrameSizeVector2The size of one frame in the sheet, in pixels.
PlayingbooleanWhether an animation is advancing. Read-only. Not saved in places.
SpeedScalenumberMultiplies 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.

Apache License 2.0