animateQuaternion

fun InfiniteTransition.animateQuaternion(initialValue: Quaternion, targetValue: Quaternion, animationSpec: InfiniteRepeatableSpec<Quaternion>, label: String = "Float3Animation"): State<Quaternion>

Creates an animation of Float type that runs infinitely as a part of the given InfiniteTransition.

Once the animation is created, it will run from initialValue to targetValue and repeat. Depending on the RepeatMode of the provided animationSpec, the animation could either restart after each iteration (i.e. RepeatMode.Restart), or reverse after each iteration (i.e. RepeatMode.Reverse).

If initialValue or targetValue is changed at any point during the animation, the animation will be restarted with the new initialValue and targetValue. Note: this means continuity will not be preserved.

A label for differentiating this animation from others in android studio.

See also


inline fun <S> Transition<S>.animateQuaternion(noinline transitionSpec: @Composable Transition.Segment<S>.() -> FiniteAnimationSpec<Quaternion> = { spring() }, label: String = "QuaternionAnimation", targetValueByState: @Composable (state: S) -> Quaternion): State<Quaternion>

Creates a Quaternion animation as a part of the given Transition. This means the states of this animation will be managed by the Transition.

targetValueByState is used as a mapping from a target state to the target value of this animation. Transition will be using this mapping to determine what value to target this animation towards. Note that targetValueByState is a composable function. This means the mapping function could access states, CompositionLocals, themes, etc. If the targetValue changes outside of a Transition run (i.e. when the Transition already reached its targetState), the Transition will start running again to ensure this animation reaches its new target smoothly.

An optional transitionSpec can be provided to specify (potentially different) animation for each pair of initialState and targetState. FiniteAnimationSpec includes any non-infinite animation, such as tween, spring, keyframes and even repeatable, but not infiniteRepeatable. By default, transitionSpec uses a spring animation for all transition destinations.

label is used to differentiate from other animations in the same transition in Android Studio.

Return

A State object, the value of which is updated by animation