All Projects → patrixr → love-animation

patrixr / love-animation

Licence: MIT license
💚 A minimal Love2D animation library

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to love-animation

animX
An animation library for Love2D with unique features
Stars: ✭ 17 (-34.62%)
Mutual labels:  love2d, love2d-animation-library
Aseprite
Animated sprite editor & pixel art tool (Windows, macOS, Linux)
Stars: ✭ 14,832 (+56946.15%)
Mutual labels:  sprites
Ol Games
🎮 Game stuff for Openlayers, powered by HTML5, canvas, javascript and Openlayers.
Stars: ✭ 61 (+134.62%)
Mutual labels:  sprites
Glueit
🎨 Simple SpriteSheet Tool
Stars: ✭ 119 (+357.69%)
Mutual labels:  sprites
Mq Sprite
A sprite editor.
Stars: ✭ 65 (+150%)
Mutual labels:  sprites
Sprite Wxapp
spritejs 小程序版
Stars: ✭ 138 (+430.77%)
Mutual labels:  sprites
Blit
👾 Blitting library for 2D sprites
Stars: ✭ 15 (-42.31%)
Mutual labels:  sprites
Pixieditor
PixiEditor is a lightweight pixel art editor made with .NET 5
Stars: ✭ 210 (+707.69%)
Mutual labels:  sprites
Deadsimple Pixel Perfect Camera
An exceedingly easy-to-use pixel perfect orthographic camera script for 2D scenes in Unity. Punch in a few specs and you've got a working pixel perfect camera. It's that easy.
Stars: ✭ 186 (+615.38%)
Mutual labels:  sprites
Teenyicons
Tiny minimal 1px icons designed to fit in the smallest places.
Stars: ✭ 1,631 (+6173.08%)
Mutual labels:  sprites
Potpack
A tiny rectangle packing JavaScript library (for sprite layouts)
Stars: ✭ 115 (+342.31%)
Mutual labels:  sprites
Citro2d
Library for drawing 2D graphics using the Nintendo 3DS's PICA200 GPU
Stars: ✭ 88 (+238.46%)
Mutual labels:  sprites
Pixelorama
A free & open-source 2D sprite editor, made with the Godot Engine! Available on Windows, Linux, macOS and the Web!
Stars: ✭ 2,535 (+9650%)
Mutual labels:  sprites
React Sprite Animator
A React component that animates simple spritesheets
Stars: ✭ 62 (+138.46%)
Mutual labels:  sprites
Svg Sprite Module
Optimize SVG files and combine them into sprite
Stars: ✭ 187 (+619.23%)
Mutual labels:  sprites
Phaser Tilemap Plus
Tilemap animations, physics, events and custom property enhancements for Tiled JSON map files
Stars: ✭ 44 (+69.23%)
Mutual labels:  sprites
Material Design Icons
Material Design icons by Google
Stars: ✭ 44,551 (+171250%)
Mutual labels:  sprites
Unflattener
Make normal maps for 2D art
Stars: ✭ 125 (+380.77%)
Mutual labels:  sprites
Sprites
Repository containing all the Pokémon sprites
Stars: ✭ 231 (+788.46%)
Mutual labels:  sprites
Video Thumbnail Generator
📷 Generate thumbnail sprites from videos.
Stars: ✭ 190 (+630.77%)
Mutual labels:  sprites

Love2D Animation library

A utility class to create animated sprites with Love2D.

Every animation is defined by:

  • an image file
  • an animation file (.lua)

The animation file describes the different frames and states of the animation, as well as the animation properties.

Take a look at animation.template.lua for an example.

Quick start

Loading the animation

local anim = LoveAnimation.new('sprites/animation1.lua');

Updating the animation

function love.update(dt)

  -- update things ...

	anim:update(dt)
end

Drawing the animation

function love.draw()

  -- draw things ...

	anim:draw()

end

Changing the animation state

anim:setState("jump")

Features

Changing state

Each state represent a row of the spritesheet, and has been defined in the animation file

anim:setState('jump')

Each state contains a nextState property which will run when all the frames have been iterated through. To create a looping animation, a state can simply have itself as the nextState

Reading the current state can be done with

anim:getCurrentState()

Speeding up / Slowing down

A "speed multiplier" can be set to either speed up or slow down the animation

anim:setSpeedMultiplier(0.5) -- slow down
anim:setSpeedMultiplier(2) -- speed up

Pausing the animation

anim:pause()
anim:unnpause()
anim:togglePause()

Callbacks

function doSomething()

end

anim:onStateStart('jumpStart', doSomething)

Cloning the animation

To create multiple instances of an animation, a clone method exists

anim:clone()

Scaling

The draw method accepts scaling arguments in order to change the size of the image

anim:draw(scaleX, scaleY)

Position / Geometry / Intersections

anim:getGeometry()
anim:intersects(x,y,width,height)
anim:setPosition(x, y)
anim:setRotation(r)
anim:setRelativeOrigin(ox, oy)
anim:setHorizontalFlip(true);
anim:getFrameWidth();
anim:getFrameHeight();
anim:getFrameDimension();

Visibility

anim:setVisibility(false)

Jumping to specific frames

The current frame can be manually selected

anim:setCurrentFrame(3)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].