class SFML::Animation

A frame-based animation that drives a Sprite’s texture_rect over time. Pair it with a SpriteSheet or TextureAtlas.

sheet = SFML::SpriteSheet.load(“hero.png”, frame_size: [32, 32]) walk = sheet.animation(fps: 12, loop: true)

def update(dt) walk.update(dt) end

def draw window.draw(walk.sprite) end

Animation is a self-contained drawable — it builds its own internal Sprite and advances texture_rect on each update. Use sprite to access the current frame’s Sprite for transform setters (position=, rotation=, etc.), or call Animation#draw_on(target) directly.

frames may be: