Crates.io | easing-function |
lib.rs | easing-function |
version | 0.1.1 |
source | src |
created_at | 2024-08-18 17:53:55.892866 |
updated_at | 2024-09-01 16:49:21.588032 |
description | A Rusty implementation of easing functions for animation tweening |
homepage | |
repository | https://github.com/khonsulabs/easing-function |
max_upload_size | |
id | 1342831 |
size | 48,358 |
A Rusty implementation of easing functions.
An easing function is a function that describes how to apply a change of a value over time. This library's easing functions expect input values between 0.0 and 1.0 and will return values corresponding to that range but may be outside of the range depending on the function.
Easing functions are typically used in animation systems to customize values produced between keyframes (tweening).
When creating Cushy, no maintained library seemed to offer a trait-based solution to allow for custom easing functions in addition to the standard ones inspired by Robert Penner's original collection.
The EasingFunction
type is the central type of this crate. It allows
defining an easing function in two ways:
EasingFunction::from_fn
: Creates an easing function from a fn(f32) -> f32
function.EasingFunction::new
: Creates an easing function from an Easing
implementor.This crate also provides the standard set of easing functions in the
[easings][easings] module (e.g., EaseInOutSine
). Finally, the
StandardEasings
enum provides access to the standard easing
functions through an enumeration. This enum also supports serde
when enabling
the serde
feature of this crate.
This project, like all projects from Khonsu Labs, is open-source. This repository is available under the MIT License or the Apache License 2.0.
To learn more about contributing, please see CONTRIBUTING.md.