{"id":13524269,"url":"https://github.com/bjornbytes/chiro","last_synced_at":"2025-07-07T07:34:24.425Z","repository":{"id":145427725,"uuid":"44459788","full_name":"bjornbytes/chiro","owner":"bjornbytes","description":"Easy Spine animations for LÖVE","archived":false,"fork":false,"pushed_at":"2018-03-18T16:43:54.000Z","size":8,"stargazers_count":27,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-02T08:32:12.099Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/bjornbytes.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-10-18T00:26:45.000Z","updated_at":"2024-05-15T09:31:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"cd55bc23-7236-4462-942f-c234924b685f","html_url":"https://github.com/bjornbytes/chiro","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/bjornbytes%2Fchiro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjornbytes%2Fchiro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjornbytes%2Fchiro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjornbytes%2Fchiro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bjornbytes","download_url":"https://codeload.github.com/bjornbytes/chiro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225486619,"owners_count":17481934,"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":[],"created_at":"2024-08-01T06:01:08.522Z","updated_at":"2024-11-20T07:32:03.508Z","avatar_url":"https://github.com/bjornbytes.png","language":"Lua","funding_links":[],"categories":["Animation"],"sub_categories":[],"readme":"Chiro\n===\n\nA library that makes it easier to work with [Spine](http://esotericsoftware.com/) animations in LÖVE\ngames.\n\nExample\n---\n\nIf your project looks like this:\n\n```\n├── main.lua\n├── chiro.lua\n├── spine-love\n├── spine-lua\n└── spineboy\n    ├── spineboy.json\n    ├── spineboy.atlas\n    └── spineboy.png\n\n```\n\nThen you can get up and running quickly by doing this in `main.lua`:\n\n```lua\nrequire 'spine-love/spine'\n\nchiro = require 'chiro'\n\nanimation = chiro.create({\n  dir = 'spineboy',\n  states = {\n    walk = {\n      loop = true\n    }\n  },\n  default = 'walk'\n})\n\nfunction love.update(delta)\n  animation:update(delta)\nend\n\nfunction love.draw()\n  love.graphics.setColor(255, 255, 255)\n  animation:draw(400, 550)\nend\n```\n\nAdvanced\n---\n\nTo create a chiro animation, call `chiro.create(options)`.  Chiro needs to know where the JSON\nfile and images folder are, which can be specified using the `dir` option.  This should point to\na directory containing a JSON file, an atlas, and a png file, all named the same as the directory.\n\nHere are the other optional options that can be customized:\n\n```lua\nlocal animation = chiro.create({\n  scale = 1, -- base scale of animation\n  flip = false, -- flip animation along the x axis\n  flip = { -- can also flip both x and y\n    x = false,\n    y = false\n  },\n  x = 0, -- x value to draw at\n  y = 0, -- y value to draw at\n  offset = {\n    x = 0, -- offset x values by this amount\n    y = 0 -- offset y values by this amount\n  },\n  speed = 1, -- global speed of animation\n  states = {\n    \u003canimationName\u003e = {\n      loop = false, -- whether or not to repeat the animation\n      track = 0, -- the track to play the animation on\n      speed = 1, -- the speed at which to play the animation\n      length = 1 -- alternatively, specify how long the animation should take to complete\n      next = \u003canimationName\u003e -- specify an animation to transition to on completion\n    }\n  },\n  on = {\n    \u003ceventName\u003e = function(animation, event) end,\n    start       = function(animation, state) end,\n    complete    = function(animation, state) end,\n    ['end']     = function(animation, state) end\n  },\n  default = \u003canimationName\u003e -- immediately start playing this animation\n})\n```\n\nAn animation should be updated to play through the tracks and set the bones in the right position.\nTo do this, call the `update` function on the chiro animation:\n\n```lua\nfunction love.update(dt)\n  animation:update(dt)\nend\n```\n\n`dt` is the number of seconds elapsed since the last call to `update`.\n\nTo draw the animation to the screen, call `draw`:\n\n```lua\nfunction love.draw()\n  animation:draw(x, y)\nend\n```\n\n`x` and `y` are optional.  They can also be set on the animation directly:\n\n```lua\nanimation.x = 100\nanimation.y = 100\n```\n\nUse `set` to play a specific animation:\n\n```lua\nanimation:set('walk') -- Play the walk animation\n```\n\nThe animation will play using the settings defined in the `states` part of the config for that\nanimation.  This can be used to control speed, looping, tracks, and can also be used to transition\nto another animation after the current one is finished playing.\n\nTo reset things, call `clear` on the animation to clear all animation tracks, or `resetTo(name)`\nto clear all tracks and begin playing an animation.\n\nTo hook into events for the animation, specify functions for keys in the `on` section of the config.\n`start`, `complete`, and `end` will be passed the animation object and the state object as\narguments.\n\nChiro also exposes most of the underlying Spine objects as properties on the animation object:\n\n- `skeletonJson`\n- `skeletonData`\n- `skeletonRenderer`\n- `skeleton`\n- `animationStateData`\n- `animationState`\n\nLicense\n---\n\nMIT, see [`LICENSE`](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjornbytes%2Fchiro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbjornbytes%2Fchiro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjornbytes%2Fchiro/lists"}