MotionScript

@motion-script/core


@motion-script/core / slerpQuaternion

Function: slerpQuaternion()

slerpQuaternion(from, to, t): Quaternion

Defined in: render3d/vector3.ts:100

Shortest-arc spherical linear interpolation — the correct tween for a quaternion. A component-wise lerp is not correct: it leaves the unit hypersphere, so the rotation speed varies and the result needs renormalizing.

Negates to when the pair points away from each other (dot < 0) so the rotation always takes the short way round; falls back to a normalized linear blend when the two are nearly parallel and sin(theta) would underflow.

Parameters

from

Quaternion

to

Quaternion

t

number

Returns

Quaternion