A object that control a single animatiopn canvas.

Constructors

  • The Constructor of App

    Parameters

    • element: HTMLCanvasElement

      The <canvas> element.

    • ck: CanvasKit

      The CanvasKit Namespace.

    • plugins: GlobalPlugin[]

      The plugins provided by CarEngine.

    Returns App

Properties

ck: CanvasKit

The CanvasKit Namespace.

cleared: boolean
config: Config

The App config.

element: HTMLCanvasElement

The <canvas> element.

last: Widget
lastFrameTime: number = ...
playing: boolean = false
plugins: GlobalPlugin[]

The plugins provided by CarEngine.

reactiveFramePerSecond: number
scene: Scene

The current scene of this app

surface: Surface
updates: ((elapsed) => void)[] = []

Updating group, which call them every update calling.

Type declaration

    • (elapsed): void
    • Parameters

      • elapsed: number

      Returns void

Methods

  • Checkout a scene.

    Parameters

    • scene: Scene

      The scene that is going to be changed.

    Returns this

    this

  • Pause the animation of this app.

    Parameters

    • Optional frame: number

      pause at frame

    Returns this

    this

  • Start to play this animation app

    Parameters

    • Optional frame: number

      Play at frame

    Returns this

    this

  • Set the background color

    Parameters

    • color: Color | "transparent"

      The Color object

    Returns this

    this

  • Set up a update function to call it when the widget is changed.

    Parameters

    • updateFunc: ((elapsed) => void)

      The frame from having gone to current frame.

        • (elapsed): void
        • Parameters

          • elapsed: number

          Returns void

    Returns void

  • Add a plugin for this app.

    Parameters

    Returns void

  • The rendering and uodate function, which called every frame.

    Parameters

    • app: App

      The App object.

    • canvas: Canvas

      The Canvas object of CanvasKit-WASM

    Returns void