Interface MotionConfig<T>

Interface for configuring motion animations in a Tween. You can specify easing, callback functions, and progress tracking functions.

interface MotionConfig<T> {
    easing?: Easing;
    onComplete?: ((target, isEnd, isStop) => void);
    onProgress?: ((target, key, start, end, alpha, reversed) => boolean | void);
    onStart?: ((target) => void);
    onUpdate?: ((target) => void);
}

Type Parameters

  • T = any

    The type of the target object being tweened.

Properties

easing?: Easing

The easing function to control the animation's progression.

onComplete?: ((target, isEnd, isStop) => void)

A callback function to execute when the animation completes.

Type declaration

    • (target, isEnd, isStop): void
    • A callback function to execute when the animation completes.

      Parameters

      • target: T

        The target object that was tweened.

      • isEnd: boolean

        是否整个动画都结束了

      • isStop: boolean

        是否强制终止了

      Returns void

Param: target

The target object that was tweened.

Param: isEnd

是否整个动画都结束了

Param: isStop

是否强制终止了

onProgress?: ((target, key, start, end, alpha, reversed) => boolean | void)

A callback function to be executed before each property is updated.

Type declaration

    • (target, key, start, end, alpha, reversed): boolean | void
    • A callback function to be executed before each property is updated.

      Parameters

      • target: T

        The target object that is being tweened.

      • key: string

        The key or property being animated.

      • start: AllowedTypes

        The initial value of the animated property.

      • end: AllowedTypes

        The final value of the animated property.

      • alpha: number

        The current animation progress as a normalized value (0 to 1).

      • reversed: boolean

        是否反向

      Returns boolean | void

      If false, will not assign a new value to the property.

Param: target

The target object that is being tweened.

Param: key

The key or property being animated.

Param: start

The initial value of the animated property.

Param: end

The final value of the animated property.

Param: alpha

The current animation progress as a normalized value (0 to 1).

Param: reversed

是否反向

Returns

If false, will not assign a new value to the property.

onStart?: ((target) => void)

A callback function to execute when the animation starts.

Type declaration

    • (target): void
    • A callback function to execute when the animation starts.

      Parameters

      • target: T

        The target object that is being tweened.

      Returns void

Param: target

The target object that is being tweened.

onUpdate?: ((target) => void)

A callback function to be executed after each property has been updated.

Type declaration

    • (target): void
    • A callback function to be executed after each property has been updated.

      Parameters

      • target: T

        The target object that is being tweened.

      Returns void

Param: target

The target object that is being tweened.