Animat is a lightweight and responsive animation library for managing sprite animations in the LÖVE2D framework. Inspired by anim8, it focuses on simplicity and flexibility.
- Time-based animation updates
- Playback controls: play, pause, reset
- Horizontal and vertical flipping support
- Easy quad generation via grid system
- Dynamic speed adjustment
Just copy the animat.lua file into your LÖVE2D project:
local animat = require("animat")-- Load sprite and create animation
local sprite = love.graphics.newImage("spritesheet.png")
local grid = animat.newGrid(sprite, 6, 4) -- 6 columns, 4 rows
local animation = animat.newAnimation(grid("1-4", 2), 0.1)
function love.update(dt)
animation:update(dt)
end
function love.draw()
animation:draw(sprite, 100, 100)
endReturns a function that generates a list of Quad objects based on column and row ranges.
spriteSheet: alove.graphics.Imagecolumns: number of columns in the spritesheetrows: number of rows (lines) in the spritesheet- Usage:
grid("1-6", 4)to get columns 1 to 6 from row 4
Creates a new animation object with the given frames and frame interval.
update(dt)draw(image, x, y, r, sx, sy, ox, oy)pause(),resume(),reset()setFrame(n),setInterval(t),setSpeed(m)setFlipH(true/false),getFlipH()setFlipV(true/false),getFlipV()
MIT © 2025 Rafael de Carvalho Bluhm
Contributions, ideas, and improvements are welcome! Feel free to open an issue or a pull request.