Application render tree

Hierarchy (View Summary)

Constructors

Properties

animations: AnimationManager

The root Application Element

c2d?: CanvasRenderingContext2D
dt: number
frameCounter: number

Number of frames rendered since App launch

gl?: WebGLRenderingContext
platform: WebPlatform
rectangleTexture: RectangleTexture
textureManager: TextureManager
transitions: TransitionManager

Accessors

  • get coordsHeight(): number
  • Gets the height of the internal coordinate system of the Stage

    Returns number

    Same as this expression:

    this.h / this.getOption('precision')
    
  • get coordsWidth(): number
  • Gets the width of the internal coordinate system of the Stage

    Returns number

    Same as this expression:

    this.w / this.getOption('precision')
    
  • get mode(): 0 | 1
  • Returns the rendering mode.

    Returns 0 | 1

    • 0 = WebGL
    • 1 = Canvas2D
  • get usedMemory(): number
  • Amount of memory used (in pixels)

    Returns number

  • get usedVram(): number
  • Amount of memory used by textures (in bytes)

    Returns number

  • get usedVramAlpha(): number
  • Amount of memory used by textures with alpha channel (in bytes)

    Returns number

  • get usedVramNonAlpha(): number
  • Amount of memory used by textures without alpha channel (in bytes)

    Returns number

Methods

  • Runs the texture memory garbage collector.

    Parameters

    • Optionalaggressive: boolean

    Returns void

    By default this will clean up all currently unused textures from the application.

    If agressive is set to true, it will clean up ALL textures regardless of if they are in use.

  • Gets the active Canvas HTML Element used for rendering

    Returns HTMLCanvasElement

  • Creates a new Canvas Element for use for offscreen drawing

    Returns HTMLCanvasElement

  • Gets an option value from the active set of Stage.Options

    Type Parameters

    • T extends keyof Lightning.Stage.Options
    • O extends
          | null
          | string
          | number
          | boolean
          | HTMLCanvasElement
          | CanvasRenderingContext2D
          | WebGLRenderingContext
          | { fontSize: number; precision: number }
          | RGBA
          | typeof WebPlatform

    Parameters

    • optionKey: T

    Returns O

  • Returns true if the rendering mode is Canvas2d.

    Returns boolean

  • Returns true if the frame is currently updating

    Returns boolean

  • Returns true if the rendering mode is WebGL.

    Returns boolean

  • Resumes the rendering loop

    Returns void

    This must be called after stop to resume frame rendering.

  • Stops the rendering loop

    Returns void

    This will halt all frame rendering until resume is called.

  • Force update of the render tree layout

    Returns void

    Call this to ensure the finalX, finalY, finalW, finalH properties of Elements are updated appropriately without waiting for a frame to render.

    See Flexbox for more information.

  • Returns true if WebGL is supported by the platform.

    Returns boolean