{"id":17011295,"url":"https://github.com/qeffects/flux","last_synced_at":"2025-10-06T21:53:23.656Z","repository":{"id":100206570,"uuid":"240052994","full_name":"qeffects/flux","owner":"qeffects","description":"A rehost of flux","archived":false,"fork":false,"pushed_at":"2020-02-12T16:00:17.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-27T12:48:38.712Z","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/qeffects.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-12T15:55:54.000Z","updated_at":"2022-07-23T10:23:13.000Z","dependencies_parsed_at":"2023-05-12T21:00:42.112Z","dependency_job_id":null,"html_url":"https://github.com/qeffects/flux","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/qeffects%2Fflux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qeffects%2Fflux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qeffects%2Fflux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qeffects%2Fflux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qeffects","download_url":"https://codeload.github.com/qeffects/flux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244960064,"owners_count":20538746,"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-10-14T06:06:42.804Z","updated_at":"2025-10-06T21:53:18.626Z","avatar_url":"https://github.com/qeffects.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flux\nA fast, lightweight tweening library for Lua.\n\n## Installation\nThe [flux.lua](flux.lua?raw=1) file should be dropped into an existing project\nand required by it.\n```lua\nflux = require \"flux\"\n``` \nThe `flux.update()` function should be called at the start of each frame. As\nits only argument It should be given the time in seconds that has passed since\nthe last call.\n```lua\nflux.update(deltatime)\n```\n\n## Usage\nAny number of numerical values in a table can be tweened simultaneously. Tweens\nare started by using the `flux.to()` function. This function requires 3\narguments:\n* `obj` The object which contains the variables to tween\n* `time` The amount of time the tween should take to complete\n* `vars` A table where the keys correspond to the keys in `obj` which should be\n  tweened, and their values correspond to the destination\n```lua\n-- Moves the ball object to the position 200, 300 over 4 seconds\nflux.to(ball, 4, { x = 200, y = 300 })\n```\nIf you try to tween a variable which is already being tweened, the original\ntween stops tweening the variable and the new tween begins from the current\nvalue.\n\n### Additional options\nAdditional options when creating a tween can be set through the use of chained\nfunctions provided by the tween object which `flux.to()` returns.\n```lua\nflux.to(t, 4, { x = 10 }):ease(\"linear\"):delay(1)\n```\n\n#### :ease(type)\nThe easing type which should be used by the tween; `type` should be a string\ncontaining the name of the easing to be used. The library provides the\nfollowing easing types:\n\n  `linear`\n  `quadin`       `quadout`       `quadinout`\n  `cubicin`      `cubicout`      `cubicinout`\n  `quartin`      `quartout`      `quartinout`\n  `quintin`      `quintout`      `quintinout`\n  `expoin`       `expoout`       `expoinout`\n  `sinein`       `sineout`       `sineinout`\n  `circin`       `circout`       `circinout`\n  `backin`       `backout`       `backinout`\n  `elasticin`    `elasticout`    `elasticinout`\n\nThe default easing type is `quadout`. Examples of the different easing types\ncan be [found here](http://easings.net/).\n\n\n#### :delay(time)\nThe amount of time flux should wait before starting the tween; `time` should be\na number of seconds. The default delay time is `0`.\n\n#### :onstart(fn)\nSets the function `fn` to be called when the tween starts (once the delay has\nfinished). `:onstart()` can be called multiple times to add more than one\nfunction.\n\n#### :onupdate(fn)\nSets the function `fn` to be called each frame the tween updates a value.\n`onupdate()` can be called multiple times to add more than one function.\n\n#### :oncomplete(fn)\nSets the function `fn` to be called once the tween has finished and reached its\ndestination values. `oncomplete()` can be called multiple times to add more\nthan one function.\n\n#### :after([obj,] time, vars)\nCreates a new tween and chains it to the end of the existing tween; the chained\ntween will be called after the original one has finished. Any additional\nchained function used after `:after()` will effect the chained tween. There is\nno limit to how many times `:after()` can be used in a chain, allowing the\ncreation of long tween sequences. If `obj` is not specified the `obj` argument\nfrom the original tween is used.\n```lua\n-- Tweens t.x to 10 over 2 seconds, then to 20 over 1 second\nflux.to(t, 2, { x = 10 }):after(t, 1, { x = 20 })\n```\n\n### Stopping a tween\nIf you want the ability to stop a tween before it has finished, the tween\nshould be assigned to a variable when it is created.\n```lua\nlocal tween = flux.to(x, 2, { y = 20 }):delay(1)\n```\nThe tween can then be stopped at any point by calling its `:stop()` method.\n```lua\ntween:stop()\n```\nThis will cause the tween to immediatly be removed from its parent group and\nwill leave its tweened variables at their current values. The tween's\n`oncomplete()` callback is not called.\n\n### Groups\nflux provides the ability to create tween groups; these are objects\nwhich can have tweens added to them, and who are in charge of updating and\nhandling their contained tweens. A group is created by calling the\n`flux.group()` function.\n```lua\ngroup = flux.group()\n```\nOnce a group is created it acts independently of the `flux` object, and must\nbe updated each frame using its own update method.\n```lua\ngroup:update(deltatime)\n```\nTo add a tween to a group, the group's `to()` method should be used.\n```lua\ngroup:to(t, 3, { x = 10, y = 20 })\n```\nA good example of where groups are useful is for games where you may have a set\nof tweens which effect objects in the game world and which you want to pause\nwhen the game is paused.  A group's tweens can be paused by simply neglecting\nto call its `update()` method; when a group is destroyed its tweens are also\ndestroyed.\n\n\n## License\nThis library is free software; you can redistribute it and/or modify it under\nthe terms of the MIT license. See [LICENSE](LICENSE) for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqeffects%2Fflux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqeffects%2Fflux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqeffects%2Fflux/lists"}