-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.15 Release Notes: Easing curves (#1790)
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
- Loading branch information
1 parent
d1fa913
commit 53e0843
Showing
5 changed files
with
31 additions
and
8 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
4 changes: 0 additions & 4 deletions
4
...lease-notes/14788_add_curve_utilities_to_create_curves_interpolatingeasing_b.md
This file was deleted.
Oops, something went wrong.
29 changes: 28 additions & 1 deletion
29
release-content/0.15/release-notes/15675_Add_most_common_interpolations.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,31 @@ | ||
<!-- Add most common interpolations --> | ||
<!-- https://github.com/bevyengine/bevy/pull/15675 --> | ||
|
||
<!-- TODO --> | ||
"Easing functions" can be used to easily construct curves that interpolate between two values. | ||
There are many "common" easing functions that each have a different "character" to them. These | ||
are often used in "tweening" scenarios to give life to the interpolation. | ||
|
||
<video controls><source src="ease-functions.mp4" type="video/mp4"/></video> | ||
|
||
**Bevy 0.15** adds a new `Ease` trait, which defines how to interpolate a value of a given type. The `Ease` types include: | ||
|
||
* vector types (`f32`, `Vec2`, `Vec3`, ...); | ||
* direction types (`Dir2`, `Dir3`, `Dir3A`); | ||
* rotation types (`Rot2`, `Quat`). | ||
|
||
We've also added an `EaseFunction` enum, which defines many common easing functions. The new `easing_curve` constructor uses these as inputs to define a final `Curve` from the given easing parameters. | ||
|
||
For example, we can use an easing function to interpolate between two rotations: | ||
|
||
```rust | ||
// Ease between no rotation and a rotation of angle PI/2 about the y-axis. | ||
let rotation_curve = easing_curve( | ||
Quat::IDENTITY, | ||
Quat::from_rotation_y(FRAC_PI_2), | ||
EaseFunction::ElasticInOut, | ||
) | ||
.reparametrize_linear(interval(0.0, 4.0).unwrap()) | ||
.unwrap(); | ||
``` | ||
|
||
<video controls><source src="eased-rotation.mp4" type="video/mp4"/></video> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters