{"id":13524340,"url":"https://github.com/sixFingers/lump","last_synced_at":"2025-04-01T02:31:13.298Z","repository":{"id":142572644,"uuid":"62301659","full_name":"sixFingers/lump","owner":"sixFingers","description":"Flump runtime for LÖVE2D.","archived":false,"fork":false,"pushed_at":"2016-07-05T08:08:08.000Z","size":105,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-02T08:32:19.422Z","etag":null,"topics":[],"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/sixFingers.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":"2016-06-30T10:18:28.000Z","updated_at":"2024-08-25T02:23:58.000Z","dependencies_parsed_at":"2024-01-03T04:02:34.737Z","dependency_job_id":null,"html_url":"https://github.com/sixFingers/lump","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/sixFingers%2Flump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixFingers%2Flump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixFingers%2Flump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixFingers%2Flump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sixFingers","download_url":"https://codeload.github.com/sixFingers/lump/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246572271,"owners_count":20798931,"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:09.135Z","updated_at":"2025-04-01T02:31:12.958Z","avatar_url":"https://github.com/sixFingers.png","language":"Lua","funding_links":[],"categories":["Animation"],"sub_categories":[],"readme":"# lump\nLump is a [Flump](https://github.com/tconkling/flump) runtime for LÖVE2D.\nIt allows playing MovieClips exported from Flump through a Flash/Actionscript like API.\n\nAnimations exported from Flump are cleverly optimized:\n\n- all of the animation component sprites are packed inside a texture;\n- a json file describes clips and frame properties;\n- one single animation can hold many different states (idle, walk, ...)\n- the memory footprint is generally smaller than that of prerendered sprite animations;\n- they're smooooth as flumps.\n\n## Status\nThe library has been in use for some time now in a game of mine, and seems to be pretty stable. Nonetheless, it may be improved in a number of ways. Please consider this beta status.\n\n## Demo\nA simple demo playing Flump's logo animation is available in `/demo`. It requires Love2D 0.10.1\n\n## MovieClip API\n\n### Requiring and initializing\n\n```\nMovieClip = require(\"lump\")\n\nlocal json = \"library.json\"\nlocal atlas = \"atlas.png\"\n\nmc = MovieClip.new(json, atlas, 33) -- loads the given animation, playing it at given framerate\n```\n\nAfter initialization, the movieclip frame pointer is set at the first frame (1) of the first available clip.\n\n### Playing the animation\n\n```\n-- in love.update\nmc:update(dt)\n\n-- in love.draw\nmc:draw()\n```\n\n### Playback API\nThe api tries to mimick the original Flash API:\n\n```\n-- go at frame 1 of current clip, or first clip\nmc.gotoAndStop(1)\n\n-- stop at frame 1 of clip \"walk\"\nmc.gotoAndStop(\"walk\", 1) \n\n-- go at frame 1 of current clip, or first clip, then play\nmc.gotoAndPlay(1) \n\n-- play from frame 1 of clip \"walk\"\nmc.gotoAndPlay(\"walk\", 1) \n\n-- stop / play\nmc.stop()\nmc.play()\n```\n\n### MovieClip frame labels and events\n\nFlump exports Flash frame labels, and the library offers a simple way to hook into the enterframe event.\nThis way, it's possible to use labeled frames as triggers for actions in your code.\nAll there is to do is to define `.onFrameLabel` function. The function will be called every time a labeled frame is encountered, and will be passed the label and the frame number relative to the current clip. A good example is playing a step sound everytime a character's foot is on ground:\n\n```\nmc.onFrameLabel = function(label, frame)\n  if (label == \"foot_left) then playSound(\"step_left\") end\n  if (label == \"foot_right) then playSound(\"step_leftright\") end\nend\n```\n\n### MovieClip transforms and properties\n\nTwo properties describe current animation state:\n\n```\nmc.currentClipName = \"walk\"\nmc.currentFrame = 1\n```\n\nMovieclips supports transforms and uses `love.graphics` matrix internally:\n\n```\n-- Move so that the center is at 200, 200\nmc.x, mc.y = 200, 200 \n\n-- Rotate\nmc.rotation = math.pi / 2\n\n-- Scale\nmc.scaleX, mc.scaleY = 2, 2\n\n-- Flip on axis\nmc.scaleX, mc.scaleY = -1, 1\n```\n\n### Caching of animations\nEverytime you build a movieclip, internally Lump creates:\n\n- an animation definition, containing data for frames and clips;\n- a movieclip object, which plays the animation.\n\nFor performance, Lump will cache animations so that every movieclip created with the same json and same texture will be actually pointing to the same animation definition. No duplicate animation instances will be created.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FsixFingers%2Flump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FsixFingers%2Flump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FsixFingers%2Flump/lists"}