Skip to content

animate

hhh edited this page Mar 21, 2022 · 2 revisions

animate

/**
 * Type of options of {@link animate}.
 */
interface AnimateOptions<TargetType extends CanvasNode<any>> {
    /**
     * The target of the animation.
     */
    target: TargetType;
    /**
     * The key of the property to animate.
     * (The property value must be a number.)
     */
    key: keyof TargetType;
    /**
     * Start value.
     * @default target[key]
     */
    from?: number;
    /**
     * End value.
     */
    to: number;
    /**
     * Duration of animation. (ms)
     * @default 1000
     */
    duration?: number;
    /**
     * The timing function to use.
     * @default Timing.linear
     */
    timing?: TimingFunction;
    /**
     * The root node of the target.
     * (When this is available, `root.updateAndRender`
     * will be invoked automatically on animation update.)
     * @default target.getRoot()
     */
    root?: CanvasRoot<any>;
    /**
     * Start time stamp.
     * @default Schedule.getTimeStamp()
     */
    timeStamp?: number;
}

/**
 * Animate specific property.
 */
const animate: <TargetType extends CanvasNode<any>>(options: AnimateOptions<TargetType>) => Animation<AnimationEvents>;

Documentation of canvasom

Clone this wiki locally