AutoMovie API
    Preparing search index...

    Function inertializeOffset

    • The decaying offset of one channel after a transition, by inertialization.

      Bollo (Inertialization: High-Performance Animation Transitions in Gears of War, GDC 2018) replaces a cross-fade with an offset: at the cut the new motion starts at once, and the difference between the old and the new value (x0) and velocity (v0) decays to zero over t1 seconds on a quintic with zero value, velocity and acceleration at t1. Written about s = t1 - t, that quintic is x(t) = s^4 (b + c s) with b = (5 x0 + v0 t1) / t1^4 and c = -(4 x0 + v0 t1) / t1^5: it starts at x0 with slope v0, so the displayed value and velocity are continuous at the cut, and it keeps the sign of x0 exactly when b does, that is when t1 <= -5 x0 / v0 for a velocity heading toward zero. Bollo's clamp shortens t1 to that bound, so the offset never overshoots; a velocity heading away needs no clamp. A zero offset leaves the signed lobe v0 s^4 t / t1^4, which returns to zero without crossing it.

      Unlike a critically damped spring, which only approaches zero, the quintic ends at exactly zero at t1, so a transition has a finite, known end; it is closed-form in the elapsed time, so any frame can be evaluated alone, and it is the method of Unreal's Inertialization node.

      The clamp buys its guarantee with acceleration: the quintic starts at -(8 v0 t1 + 20 x0) / t1^2, which at the clamped time is 4 v0^2 / (5 x0), without bound as a channel is cut nearer the instant it passes its target. A channel cut there stops within milliseconds, a step in velocity in all but name. With through the clamp is not taken: the same quintic runs the whole duration, so its starting acceleration stays within (8 |v0| duration + 20 |x0|) / duration^2, and the offset passes through zero and returns, by no more than the velocity in excess of 5 |x0| / duration times 256 duration / 3125, the peak of the signed lobe. That is the follow-through of a body that reaches a pose at speed.

      Parameters

      • x0: number

        Offset at the cut, any unit.

      • v0: number

        Offset velocity at the cut, that unit per second.

      • duration: number

        Requested decay time t1, seconds; positive.

      • elapsed: number

        Seconds since the cut.

      • through: boolean = false

        Whether an offset heading to zero faster than the decay absorbs passes through it, bounded as above, instead of stopping short.

      Returns IAutoMovieInertializeOffset.IState

      The offset, its velocity and the decay time used.