Skip to content

Commit

Permalink
0.15 Release Notes: Easing curves (#1790)
Browse files Browse the repository at this point in the history
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
  • Loading branch information
mweatherley and cart authored Nov 13, 2024
1 parent d1fa913 commit 53e0843
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
Binary file not shown.
Binary file not shown.

This file was deleted.

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>
6 changes: 3 additions & 3 deletions release-content/0.15/release-notes/_release-notes.toml
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,9 @@ file_name = "15627_Add_more_tools_for_traversing_hierarchies.md"

[[release_notes]]
title = "Add most common interpolations"
authors = ["@mockersf"]
contributors = []
prs = [15675]
authors = ["@RobWalt", "@mockersf", "@mweatherley"]
contributors = ["@NthTensor", "@eckz", "@alice-i-cecile"]
prs = [14788, 15675, 15711]
file_name = "15675_Add_most_common_interpolations.md"

[[release_notes]]
Expand Down

0 comments on commit 53e0843

Please sign in to comment.