Skip to content

animation-mixer overview


Table of contents


utils

AnimationFunction (type alias)

Signature

export type AnimationFunction<T> = (elapsed: number, delta: number) => T

AnimationMixer (class)

A class that performs property animations for a specific type T by using provided animation function. Supports smooth transition between animation function by interpolating between values over time. The current value of the animation can be subscribed to using the subscribeToValue property. The animation function can be changed with transitAnimationFunction or transitFromStaticState.

Signature

export declare class AnimationMixer<T, D, R, VTypeDoc, PTypeDoc> {
  constructor(
    protected _animationFunction: AnimationFunction<T>,
    protected _lerp: (a: T, b: T, t: number) => T = (a, b, t) => b
  )
}

transitFromStaticState (method)

Set output to static value and smoothly transit to new control function

Signature

transitFromStaticState(
    state: T,
    newFunc: AnimationFunction<T>,
    transitionDuration: number,
    easing: (t: number) => number = x => x,
  )

transitAnimationFunction (method)

Smoothly transit to new control function

Signature

transitAnimationFunction(
    newFunc: AnimationFunction<T>,
    transitionDuration: number,
    easing: (t: number) => number = x => x,
  )

onSpawned (method)

Signature

onSpawned(world: GgWorld<D, R, VTypeDoc, PTypeDoc>)

dispose (method)

Signature

dispose(): void

tickOrder (property)

Signature

readonly tickOrder: number

_value$ (property)

A subject that emits the current value of the animation on every tick.

Signature

readonly _value$: any