{"id":26378424,"url":"https://github.com/cyypherus/lilt","last_synced_at":"2025-03-17T04:51:55.828Z","repository":{"id":245626660,"uuid":"818796505","full_name":"cyypherus/lilt","owner":"cyypherus","description":"A simple library for running interruptable, transition based animations as a function of time.","archived":false,"fork":false,"pushed_at":"2025-02-03T19:44:01.000Z","size":541,"stargazers_count":40,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T16:56:55.663Z","etag":null,"topics":["animation","animations","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/cyypherus.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":"2024-06-22T22:31:29.000Z","updated_at":"2025-02-18T09:49:24.000Z","dependencies_parsed_at":"2024-06-23T03:56:47.422Z","dependency_job_id":"ea20e17c-a44e-4e41-a358-68ccd51a6036","html_url":"https://github.com/cyypherus/lilt","commit_stats":null,"previous_names":["ejjonny/lilt","cyypherus/lilt"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyypherus%2Flilt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyypherus%2Flilt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyypherus%2Flilt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyypherus%2Flilt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyypherus","download_url":"https://codeload.github.com/cyypherus/lilt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243976511,"owners_count":20377691,"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","animations","rust"],"created_at":"2025-03-17T04:51:54.976Z","updated_at":"2025-03-17T04:51:55.809Z","avatar_url":"https://github.com/cyypherus.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lilt\n\n\u003cimg src=\"https://github.com/ejjonny/lilt/assets/17223924/2c5c1971-f10e-4766-9252-0ff8194e3e5d\" width=\"100%\"\u003e\n\n![rust](https://github.com/ejjonny/lilt/actions/workflows/rust.yml/badge.svg)\n[![coverage](https://codecov.io/github/ejjonny/lilt/main/graph/badge.svg?token=4XJNXRSQNX)](https://codecov.io/github/ejjonny/lilt)\n[![crates.io](https://img.shields.io/crates/v/lilt.svg)](https://crates.io/crates/lilt)\n[![docs.rs](https://img.shields.io/badge/docs.rs-lilt-blue?logo=docs.rs)](https://docs.rs/lilt)\n[![downloads](https://img.shields.io/crates/d/lilt.svg)](https://crates.io/crates/lilt)\n[![license](https://img.shields.io/crates/l/lilt.svg)](https://github.com/lilt/blob/master/LICENSE)\n\nA simple library for running interruptable, transition based animations as a function of time.\n\nThis library only implements animations \u0026 would be most useful along with a GUI library that can do GUI things (like [iced](https://github.com/iced-rs/iced)).\n\n## Getting Started\n\n### Define\n\nEmbed the state you want to animate in an `Animated` struct.\n\n```rust\nstruct MyViewState {\n    toggle: Animated\u003cbool, Instant\u003e,\n}\n```\n\nWhen you initialize your view state - define the initial state \u0026 configure the animation to your liking.\n\n```rust\nlet mut state = MyViewState {\n    toggle: Animated::new(false)\n        .duration(300.)\n        .easing(Easing::EaseOut)\n        .delay(30.)\n        .repeat(3),\n};\n```\n\n### Transition\n\nWhen your state needs an update, call the `transition` function on your animated state, passing the current time.\n\n```rust\nlet now = std::time::Instant::now();\nstate\n    .toggle\n    .transition(!state.animated_toggle.value, now);\n```\n\n### Render\n\nWhile rendering a view based on your state - use the `animate` function on your state to get the interpolated value for the current frame.\n\n```rust\nlet now = std::time::Instant::now();\n\n// The wrapped value can be used to interpolate any values that implement `Interpolable`\nlet animated_width = self.toggle.animate_bool(100., 500., now);\n\n// If the wrapped value itself is `Interpolable`, it can easily be interpolated in place\nlet animated_width = self.width.animate_wrapped(now);\n\n// There are plenty of `animate` methods for interpolating things based on the wrapped value.\n```\n\n### What's the point?\n\nlilt emerged from the need for ELM compatible / reactive animations.\n\nThe animations modeled by this library don't require periodic mutation like a 'tick' function - all interim states of the animation are predefined when 'transition' is called, \u0026 then accessed while rendering based on the current time.\n\nlilt animations are fully independent of frame rate or tick frequency \u0026 only need to be computed if they're used during rendering.\n\n## [Examples](examples/)\n\n![indicator](https://github.com/ejjonny/lilt/assets/17223924/e4f81d63-67a4-4586-a2cf-309c687fd59d)\n\n### Contributing\n\nThis repo uses `cargo insta` to snapshot test the public API.\n\nIf your PR changes the public API, one of the checks will fail by default.\n\nIf the changes to the public API were intentional you can update the snapshot by running:\n\n`INSTA_UPDATE=always cargo test --features test-api`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyypherus%2Flilt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyypherus%2Flilt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyypherus%2Flilt/lists"}