ThreePipe
    Preparing search index...

    Class AnimationObject<V>

    AnimationObject - An object for containing keyframe-based animation for properties

    AnimationObject extends popmotion and interfaces with the ThreeViewer to provide a keyframe animation system that can animate any accessible property on objects, materials, or the viewer itself. It supports complex timing, easing, and serialization.

    It is used in AnimationObjectPlugin.

    Key Features:

    • Property Access: Uses dot-notation strings to access nested properties (e.g., 'position.x', 'material.roughness')
    • Keyframe System: Define multiple keyframes with custom timing and values
    • Easing Support: Built-in easing functions or custom easing functions
    • Timeline Integration: Seamlessly works with viewer's global timeline
    • Serialization: Automatically saves/loads with scene data
    • UI Integration: Generates UI controls and supports interactive editing
    • Hierarchical: Can contain child animations for complex choreography
    const anim = new AnimationObject(myObject)
    anim.access = 'position.y'
    anim.values = [0, 5, 0]
    anim.offsets = [0, 0.5, 1]
    anim.duration = 2000
    anim.ease = (x: number) => 1 - Math.cos(x * Math.PI / 2) // Custom easeOutSine
    anim.updateTarget = true
    const colorAnim = new AnimationObject(material)
    colorAnim.access = 'color'
    colorAnim.values = ['#ff0000', '#00ff00', '#0000ff', '#ff0000']
    colorAnim.offsets = [0, 0.33, 0.66, 1]
    colorAnim.duration = 4000
    anim.ease = 'easeInOutSine'
    colorAnim.delay = 500

    Type Parameters

    • V = any

    Hierarchy

    Implements

    Index

    Constructors

    Properties

    access: string = ''
    animSet: AnimationObject<any>[] = []
    animSetParallel: boolean = false
    delay: number = 0
    duration: number = 1000
    ease:
        | "linear"
        | "easeIn"
        | "easeOut"
        | "easeInOut"
        | "circIn"
        | "circOut"
        | "circInOut"
        | "backIn"
        | "backOut"
        | "backInOut"
        | "anticipate"
        | "bounceOut"
        | "bounceIn"
        | "bounceInOut"
        | "easeInOutSine" = 'easeInOutSine'
    name: string = ''
    offsets: number[] = []
    options: AnimationOptions<V> = {}
    parent?: AnimationObject<any>
    repeat: number = 0

    Number of times to repeat the animation. Doesn't work right now

    repeatDelay: number = 0

    Delay between repeats in milliseconds. Doesn't work right now

    repeatType: "loop" | "reverse" | "mirror" = 'reverse'

    Type of repeat behavior.

    • 'loop': repeats the animation from the beginning.
    • 'reverse': plays the animation in reverse after it completes.
    • 'mirror': plays the animation in reverse after it completes. todo only mirrors the time, not values?

    Doesn't work right now

    result: undefined | AnimationResult
    target?: Record<string, any>
    uiConfig: UiObjectConfig = ...
    uiObjectType?: string
    updateCamera: boolean = false
    updater: TUpdaterType[] = []
    updateScene: boolean = false
    updateTarget: boolean = false
    updateViewer: boolean = false
    uuid: string = ...
    values: V[] = []
    viewer?: ValOrFunc<undefined | ThreeViewer>

    Accessors

    Methods

    • Parameters

      • time: number

      Returns undefined | { redo: () => void; undo: () => void }

    • Parameters

      • index: number

      Returns undefined | { redo: () => void; undo: () => void }