Module bevy_tweening::lens

source ·
Expand description

Collection of predefined lenses for common Bevy components and assets.

Predefined lenses

This module contains predefined lenses for common use cases. Those lenses are entirely optional. They can be used if they fit your use case, to save some time, but are not treated any differently from a custom user-provided lens.

Rotations

Several rotation lenses are provided, with different properties.

Shortest-path rotation

The TransformRotationLens animates the rotation field of a Transform component using Quat::slerp(). It inherits the properties of that method, and in particular the fact it always finds the “shortest path” from start to end. This is well suited for animating a rotation between two given directions, but will provide unexpected results if you try to make an entity rotate around a given axis for more than half a turn, as Quat::slerp() will then try to move “the other way around”.

Angle-focused rotations

Conversely, for cases where the rotation direction is important, like when trying to do a full 360-degree turn, a series of angle-based interpolation lenses is provided:

Structs

Traits

  • A lens over a subset of a component.