Hierarchy (view full)

Constructors

Properties

animationInstances: AnimationInstance<Widget>[] = []
centerX: number
centerY: number
children: Widget[] = []

The child-widgets of the widget.

display: boolean = true
eventInstances: EventInstance<Widget>[] = []
hasSet: boolean = false
isImplemented: boolean = false
key: string = ...
last: Widget = ...
parent: Widget
plugins: WidgetPlugin[] = []
progress: number
setups: {
    generator: Generator<number | {
        animation: Animation<any>;
        duration: number;
        mode: "async" | "sync";
        params: Record<string, any>;
        setAsync: (() => { animation: Animation<any>; mode: "async" | "sync"; duration: number; params: Record<string, any>; setAsync: () => ...; setSync: () => ...; });
        setSync: (() => { animation: Animation<any>; mode: "async" | "sync"; duration: number; params: Record<string, any>; setAsync: () => ...; setSync: () => ...; });
    }, void, unknown>;
    nextFrame: number;
}[] = []

Type declaration

  • generator: Generator<number | {
        animation: Animation<any>;
        duration: number;
        mode: "async" | "sync";
        params: Record<string, any>;
        setAsync: (() => { animation: Animation<any>; mode: "async" | "sync"; duration: number; params: Record<string, any>; setAsync: () => ...; setSync: () => ...; });
        setSync: (() => { animation: Animation<any>; mode: "async" | "sync"; duration: number; params: Record<string, any>; setAsync: () => ...; setSync: () => ...; });
    }, void, unknown>
  • nextFrame: number
style: WidgetStyle = ...
updates: ((elapsed, widget) => void)[] = []

Type declaration

    • (elapsed, widget): void
    • Parameters

      Returns void

x: number
y: number

Accessors

  • get range(): WidgetRange
  • The range of the widget, taking into account the children. To be noted that this method should not be overridden.

    Returns WidgetRange

    The range of the widget.

Methods

  • Add children widgets for the widget.

    Parameters

    • Rest ...children: Widget[] | ((parent) => Widget)[]

      The added children.

    Returns this

  • Parameters

    • animation: Animation<any>
    • startAt: number
    • during: number
    • Optional params: Record<string, any>

    Returns this

  • Calculate the range of the widget, based on the self coordinate. To be noted that this method should be overridden.

    Returns WidgetRange

    The range of the widget.

  • Parameters

    • x: number
    • y: number

    Returns {
        x: number;
        y: number;
    }

    • x: number
    • y: number
  • Parameters

    • x: number
    • y: number

    Returns {
        x: number;
        y: number;
    }

    • x: number
    • y: number
  • Draw the object according to the parameters of the widget. Called when the parameters is changed.

    Parameters

    • _canvas: Canvas

      The canvas object of CanvasKit-WASM.

    Returns void

  • Called when the widget is registered.

    Parameters

    • _ck: CanvasKit

      The CanvasKit namespace

    Returns void

  • Parameters

    • x: number
    • y: number

    Returns boolean

  • Parameters

    • event: Event<Widget>
    • effect: ((widget, ...args) => any)
        • (widget, ...args): any
        • Parameters

          • widget: Widget
          • Rest ...args: any[]

          Returns any

    Returns this

  • Preload the necessary items during drawing. Called when the properties of the widget is changed. In common, we use it to initializing Paint, Rect, Path, etc.

    Parameters

    • _ck: CanvasKit

      The namespace of CanvasKit-WASM.

    • _propertyChanged: string

      The changed property of this widget

    Returns void

  • Called when the parameters is changed.

    Parameters

    • ck: CanvasKit

      The namespace of CanvasKit-WASM.

    • Optional propertyChanged: string

    Returns void

  • Parameters

    • elapsed: number

    Returns void

  • Parameters

    • elapsed: number

    Returns void

  • Parameters

    • element: HTMLCanvasElement

    Returns void

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

    Parameters

    • updateFunc: ((elapsed, widget) => void)

      The frame from having gone to current frame.

        • (elapsed, widget): void
        • Parameters

          Returns void

    Returns this

  • Update the object according to the style of the widget. Called when the style is changed.

    Parameters

    • canvas: Canvas

      The canvas object of CanvasKit-WASM.

    Returns void

  • Parameters

    • widget: Widget
    • x: number
    • y: number

    Returns {
        x: number;
        y: number;
    }

    • x: number
    • y: number
  • Parameters

    Returns {
        x: number;
        y: number;
    }

    • x: number
    • y: number