{"id":13524360,"url":"https://github.com/patrixr/love-animation","last_synced_at":"2025-07-26T12:07:59.296Z","repository":{"id":45982417,"uuid":"13721323","full_name":"patrixr/love-animation","owner":"patrixr","description":":green_heart: A minimal Love2D animation library","archived":false,"fork":false,"pushed_at":"2019-10-17T09:35:38.000Z","size":72,"stargazers_count":29,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-13T16:33:49.723Z","etag":null,"topics":["animation","game-development","hacktoberfest","love2d","love2d-animation-library","lua","sprites"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patrixr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-20T15:27:07.000Z","updated_at":"2024-04-01T03:26:46.000Z","dependencies_parsed_at":"2022-07-18T12:48:06.335Z","dependency_job_id":null,"html_url":"https://github.com/patrixr/love-animation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrixr%2Flove-animation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrixr%2Flove-animation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrixr%2Flove-animation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrixr%2Flove-animation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrixr","download_url":"https://codeload.github.com/patrixr/love-animation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247764738,"owners_count":20992163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","game-development","hacktoberfest","love2d","love2d-animation-library","lua","sprites"],"created_at":"2024-08-01T06:01:09.281Z","updated_at":"2025-04-08T02:32:10.624Z","avatar_url":"https://github.com/patrixr.png","language":"Lua","funding_links":[],"categories":["Animation"],"sub_categories":[],"readme":"Love2D Animation library\n==============\n\nA utility class to create animated sprites with Love2D.\n\nEvery animation is defined by:\n* an image file\n* an animation file (.lua)\n\nThe animation file describes the different frames and states of the animation, as well as the animation properties.\n\nTake a look at [animation.template.lua](animation.template.lua) for an example.\n\n## Quick start\n\n**Loading the animation**\n```lua\nlocal anim = LoveAnimation.new('sprites/animation1.lua');\n```\n\n**Updating the animation**\n```lua\nfunction love.update(dt)\n\n  -- update things ...\n\n\tanim:update(dt)\nend\n```\n\n**Drawing the animation**\n```lua\nfunction love.draw()\n\n  -- draw things ...\n\n\tanim:draw()\n\nend\n```\n\n**Changing the animation state**\n```lua\nanim:setState(\"jump\")\n```\n\n## Features\n\n### Changing state\n\nEach state represent a row of the spritesheet, and has been defined in the animation file\n\n```lua\nanim:setState('jump')\n```\n\nEach state contains a `nextState` property which will run when all the frames have been iterated through.\nTo create a looping animation, a state can simply have itself as the `nextState`\n\nReading the current state can be done with\n\n```lua\nanim:getCurrentState()\n```\n\n### Speeding up / Slowing down\n\nA \"speed multiplier\" can be set to either speed up or slow down the animation\n\n```lua\nanim:setSpeedMultiplier(0.5) -- slow down\nanim:setSpeedMultiplier(2) -- speed up\n```\n\n### Pausing the animation\n\n```lua\nanim:pause()\nanim:unnpause()\nanim:togglePause()\n```\n\n### Callbacks\n\n```lua\nfunction doSomething()\n\nend\n\nanim:onStateStart('jumpStart', doSomething)\n```\n\n### Cloning the animation\n\nTo create multiple instances of an animation, a clone method exists\n\n```lua\nanim:clone()\n```\n\n### Scaling\n\nThe `draw` method accepts scaling arguments in order to change the size of the image\n\n```lua\nanim:draw(scaleX, scaleY)\n```\n\n### Position / Geometry / Intersections\n\n```lua\nanim:getGeometry()\nanim:intersects(x,y,width,height)\nanim:setPosition(x, y)\nanim:setRotation(r)\nanim:setRelativeOrigin(ox, oy)\nanim:setHorizontalFlip(true);\nanim:getFrameWidth();\nanim:getFrameHeight();\nanim:getFrameDimension();\n```\n\n### Visibility\n\n```lua\nanim:setVisibility(false)\n```\n\n## Jumping to specific frames\n\nThe current frame can be manually selected\n\n```lua\nanim:setCurrentFrame(3)\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrixr%2Flove-animation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrixr%2Flove-animation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrixr%2Flove-animation/lists"}