{"id":13571775,"url":"https://github.com/vleue/bevy_easings","last_synced_at":"2025-05-15T10:02:08.433Z","repository":{"id":40647431,"uuid":"297412563","full_name":"vleue/bevy_easings","owner":"vleue","description":"Easing and simple animations for Bevy","archived":false,"fork":false,"pushed_at":"2025-04-28T20:22:01.000Z","size":16507,"stargazers_count":185,"open_issues_count":7,"forks_count":28,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-28T20:41:05.875Z","etag":null,"topics":["bevy","bevy-plugin","easing","rust","tweening"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vleue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null},"funding":{"github":"mockersf","ko_fi":"mockersf"}},"created_at":"2020-09-21T17:29:28.000Z","updated_at":"2025-04-28T20:19:07.000Z","dependencies_parsed_at":"2024-01-14T03:51:05.295Z","dependency_job_id":"4d0ff5e3-c944-4fc3-96a7-37114c844ee5","html_url":"https://github.com/vleue/bevy_easings","commit_stats":{"total_commits":204,"total_committers":15,"mean_commits":13.6,"dds":"0.11274509803921573","last_synced_commit":"d770f5f7492d66c7251e481a083dc1919de20325"},"previous_names":["mockersf/bevy_extra"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vleue%2Fbevy_easings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vleue%2Fbevy_easings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vleue%2Fbevy_easings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vleue%2Fbevy_easings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vleue","download_url":"https://codeload.github.com/vleue/bevy_easings/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319717,"owners_count":22051072,"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":["bevy","bevy-plugin","easing","rust","tweening"],"created_at":"2024-08-01T14:01:06.039Z","updated_at":"2025-05-15T10:02:06.434Z","avatar_url":"https://github.com/vleue.png","language":"Rust","funding_links":["https://github.com/sponsors/mockersf","https://ko-fi.com/mockersf"],"categories":["Rust"],"sub_categories":[],"readme":"# Bevy Easings\n\n![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)\n[![Doc](https://docs.rs/bevy_easings/badge.svg)](https://docs.rs/bevy_easings)\n[![Crate](https://img.shields.io/crates/v/bevy_easings.svg)](https://crates.io/crates/bevy_easings)\n[![Bevy Tracking](https://img.shields.io/badge/Bevy%20tracking-main-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)\n[![CI](https://github.com/vleue/bevy_easings/actions/workflows/ci.yml/badge.svg)](https://github.com/vleue/bevy_easings/actions/workflows/ci.yml)\n\nEasings on Bevy components using [interpolation](https://crates.io/crates/interpolation).\n\n![menu example](https://raw.githubusercontent.com/vleue/bevy_easings/main/examples/menu.webp)\n\n## Usage\n\n### System setup\n\nAdd the plugin to your app:\n\n```rust\nuse bevy::prelude::*;\nuse bevy_easings::EasingsPlugin;\n\nfn main() {\n    App::new()\n        .add_plugins(EasingsPlugin::default());\n}\n```\n\n### Easing a component to a new value\n\nAnd then just ease your components to their new state!\n\n```rust\nuse bevy::prelude::*;\nuse bevy_easings::Ease;\n\nfn my_system(mut commands: Commands){\n    commands\n        .spawn((\n            Sprite {\n                ..Default::default()\n            },\n            Sprite {\n                custom_size: Some(Vec2::new(10., 10.)),\n                ..Default::default()\n            }\n            .ease_to(\n                Sprite {\n                    custom_size: Some(Vec2::new(100., 100.)),\n                    ..Default::default()\n                },\n                bevy_easings::EaseFunction::QuadraticIn,\n                bevy_easings::EasingType::PingPong {\n                    duration: std::time::Duration::from_secs(1),\n                    pause: Some(std::time::Duration::from_millis(500)),\n                },\n            ),\n        ));\n}\n```\n\nIf the component being eased is not already a component of the entity, the component should first be inserted for the target entity.\n\n### Easing to a function-generated target\n\nYou can also ease to a target that is generated dynamically from the previous value using a function:\n\n```rust\nuse bevy::prelude::*;\nuse bevy_easings::Ease;\n\nfn my_system(mut commands: Commands){\n    commands\n        .spawn((\n            Transform::from_scale(Vec3::new(0.1, 0.1, 1.0))\n            .ease_to_fn(\n                |start| Transform {\n                    scale: start.scale * 10.0,\n                    ..*start\n                },\n                bevy_easings::EaseFunction::QuadraticIn,\n                bevy_easings::EasingType::PingPong {\n                    duration: std::time::Duration::from_secs(1),\n                    pause: Some(std::time::Duration::from_millis(500)),\n                },\n            )\n            .ease_to_fn(\n                |prev| Transform {\n                    scale: prev.scale * 0.5,\n                    ..*prev\n                },\n                bevy_easings::EaseFunction::CubicInOut,\n                bevy_easings::EasingType::Once {\n                    duration: std::time::Duration::from_secs(2),\n                },\n            ).with_original_value(),\n        ));\n}\n```\n\nThis is particularly useful to rescue you from repeatly writing initialize code for start status, or chaining animation without worrying about maintaining interior status.\n\n### Easing using EaseMethod\n\nThe EaseMethod enum can be used to provide easing methods that are not avaliable in EaseFunction.\n\n```rust,ignore\npub enum EaseMethod {\n    /// Follow `EaseFunction`\n    EaseFunction(EaseFunction),\n    /// Linear interpolation, with no function\n    Linear,\n    /// Discrete interpolation, eased value will jump from start to end\n    Discrete,\n    /// Use a custom function to interpolate the value\n    CustomFunction(fn(f32) -\u003e f32),\n}\n```\n\nThis is shown below\n\n```rust\nuse bevy::prelude::*;\nuse bevy_easings::Ease;\n\nfn my_system(mut commands: Commands){\n    commands\n        .spawn((\n            Sprite {\n                ..Default::default()\n            },\n            Sprite {\n                custom_size: Some(Vec2::new(10., 10.)),\n                ..Default::default()\n            }\n            .ease_to(\n                Sprite {\n                    custom_size: Some(Vec2::new(100., 100.)),\n                    ..Default::default()\n                },\n                bevy_easings::EaseMethod::Linear,\n                bevy_easings::EasingType::PingPong {\n                    duration: std::time::Duration::from_secs(1),\n                    pause: Some(std::time::Duration::from_millis(500)),\n                },\n            ),\n        ));\n}\n```\n\n### Chaining easing\n\nYou can chain easings, if they are not set to repeat they will happen in sequence.\n\n```rust\nuse bevy::prelude::*;\nuse bevy_easings::Ease;\n\nfn my_system(mut commands: Commands){\n    commands\n        .spawn((\n            Sprite {\n                ..Default::default()\n            },\n            Sprite {\n                custom_size: Some(Vec2::new(10., 10.)),\n                ..Default::default()\n            }\n            .ease_to(\n                Sprite {\n                    custom_size: Some(Vec2::new(300., 300.)),\n                    ..Default::default()\n                },\n                bevy_easings::EaseFunction::QuadraticIn,\n                bevy_easings::EasingType::Once {\n                    duration: std::time::Duration::from_secs(1),\n                },\n            )\n            .ease_to(\n                Sprite {\n                    custom_size: Some(Vec2::new(350., 350.)),\n                    ..Default::default()\n                },\n                bevy_easings::EaseFunction::QuadraticIn,\n                bevy_easings::EasingType::PingPong {\n                    duration: std::time::Duration::from_millis(500),\n                    pause: Some(std::time::Duration::from_millis(200)),\n                },\n            ),\n        ));\n}\n```\n\n## Custom component support\n\nTo be able to ease a component, it needs to implement the traits `Default` and [`Lerp`](https://docs.rs/interpolation/0.2.0/interpolation/trait.Lerp.html). This trait is re-exported by `beavy_easings`.\n\n```rust\nuse bevy::prelude::*;\nuse bevy_easings::*;\n\n#[derive(Default, Component)]\nstruct CustomComponent(f32);\nimpl Lerp for CustomComponent {\n    type Scalar = f32;\n\n    fn lerp(\u0026self, other: \u0026Self, scalar: \u0026Self::Scalar) -\u003e Self {\n        CustomComponent(interpolation::lerp(\u0026self.0, \u0026other.0, scalar))\n    }\n}\n```\n\nThe basic formula for lerp (linear interpolation) is `self + (other - self) * scalar`.\n\nThen, the system `custom_ease_system::\u003cCustomComponent\u003e` needs to be added to the application.\n\n## Examples\n\nSee [examples](https://github.com/vleue/bevy_easings/tree/main/examples)\n\n### Choosing the ease function\n\n![easing on size](https://raw.githubusercontent.com/vleue/bevy_easings/main/examples/lerping-sizes.webp)\n\n![easing on color](https://raw.githubusercontent.com/vleue/bevy_easings/main/examples/lerping-color.webp)\n\nWhen easing colors, pay attention on the color space you are using\n\n![color spaces](https://raw.githubusercontent.com/vleue/bevy_easings/main/examples/lerping-color-spaces.webp)\n\n## Ease Functions\n\nMany [ease functions](https://docs.rs/interpolation/0.2.0/interpolation/enum.EaseFunction.html) are available:\n\n- QuadraticIn\n- QuadraticOut\n- QuadraticInOut\n- CubicIn\n- CubicOut\n- CubicInOut\n- QuarticIn\n- QuarticOut\n- QuarticInOut\n- QuinticIn\n- QuinticOut\n- QuinticInOut\n- SineIn\n- SineOut\n- SineInOut\n- CircularIn\n- CircularOut\n- CircularInOut\n- ExponentialIn\n- ExponentialOut\n- ExponentialInOut\n- ElasticIn\n- ElasticOut\n- ElasticInOut\n- BackIn\n- BackOut\n- BackInOut\n- BounceIn\n- BounceOut\n- BounceInOut\n\n## Bevy supported version\n\n|Bevy|bevy_easings|\n|---|---|\n|main|main|\n|0.16|0.16|\n|0.15|0.15|\n|0.14|0.14|\n|0.13|0.14|\n|0.12|0.12|\n|0.11|0.11|\n|0.10|0.10|\n|0.9|0.9|\n|0.8|0.8|\n|0.7|0.7|\n|0.6|0.6|\n|0.5|0.4|\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvleue%2Fbevy_easings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvleue%2Fbevy_easings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvleue%2Fbevy_easings/lists"}