Interface Render2dType

interface Render2dType {
    animation: default;
    dom?: HTMLElement;
    handler: Handler;
    id: number;
    painter: PainterBase;
    storage: default;
    add(el): void;
    clear(): void;
    clearAnimation(): void;
    configLayer(zLevel, config): void;
    dispose(): void;
    findHover(x, y): {
        target: Displayable<DisplayableProps>;
        topTarget: Displayable<DisplayableProps>;
    };
    flush(): void;
    getBackgroundColor(): string | GradientObject | PatternObject;
    getHeight(): number;
    getWidth(): number;
    isDarkMode(): boolean;
    off(eventName?, eventHandler?): void;
    on<Ctx>(eventName, eventHandler, context?): this;
    on<Ctx>(eventName, eventHandler, context?): this;
    refresh(): void;
    refreshHover(): void;
    refreshHoverImmediately(): void;
    refreshImmediately(fromInside?): void;
    remove(el): void;
    resize(opts?): void;
    setBackgroundColor(backgroundColor): void;
    setCursorStyle(cursorStyle): void;
    setDarkMode(darkMode): void;
    setSleepAfterStill(stillFramesCount): void;
    trigger(eventName, event?): void;
    wakeUp(): void;
}

Hierarchy

  • Render2D
    • Render2dType

Properties

animation: default
dom?: HTMLElement

Not necessary if using SSR painter like svg-ssr

handler: Handler
id: number
painter: PainterBase
storage: default

Methods

  • 添加元素

    Parameters

    Returns void

  • Clear all objects and the canvas.

    Returns void

  • Stop and clear all animation immediately

    Returns void

  • Change configuration of layer

    Parameters

    • zLevel: number
    • config: LayerConfig

    Returns void

  • Dispose self.

    Returns void

  • Perform all refresh

    Returns void

  • Returns string | GradientObject | PatternObject

  • Get container height

    Returns number

  • Get container width

    Returns number

  • Returns boolean

  • Unbind event

    Parameters

    • Optional eventName: string

      Event name

    • Optional eventHandler: ((...args) => boolean | void)

      Handler function

        • (...args): boolean | void
        • Parameters

          • Rest ...args: any[]

          Returns boolean | void

    Returns void

  • Type Parameters

    • Ctx

    Parameters

    Returns this

  • Type Parameters

    • Ctx

    Parameters

    • eventName: string
    • eventHandler: WithThisType<((...args) => boolean | void), unknown extends Ctx
          ? Render2dType
          : Ctx>
    • Optional context: Ctx

    Returns this

  • Mark and repaint the canvas in the next frame of browser

    Returns void

  • Refresh hover in next frame

    Returns void

  • Refresh hover immediately

    Returns void

  • Repaint the canvas immediately

    Parameters

    • Optional fromInside: boolean

    Returns void

  • 删除元素

    Parameters

    Returns void

  • Resize the canvas. Should be invoked when container size is changed

    Parameters

    • Optional opts: {
          height?: string | number;
          width?: string | number;
      }
      • Optional height?: string | number
      • Optional width?: string | number

    Returns void

  • Set background color

    Parameters

    Returns void

  • Set default cursor

    Parameters

    • cursorStyle: string

    Returns void

  • Force to set dark mode

    Parameters

    • darkMode: boolean

    Returns void

  • Set sleep after still for frames. Disable auto sleep when it's 0.

    Parameters

    • stillFramesCount: number

    Returns void

  • Trigger event manually

    Parameters

    • eventName: string

      Event name

    • Optional event: unknown

      Event object

    Returns void

  • Wake up animation loop. But not render.

    Returns void