Skip to content

OffscreenCanvas

  • Functional description: Off-screen canvas instance, available through wx.createOffscreenCanvas create.

  • Properties

    PropertiesTypeDescription
    widthnumberCanvas width.
    heightnumberCanvas height.

* Method set

createImage

TIP

The API usage is as follows: Image OffscreenCanvas.createImage()

  • Functional description: Create an image object. Supports use in 2D Canvas and WebGL Canvas, but does not support mixing 2D and WebGL methods.
  • Return value: Image Note that it is not allowed to mix image objects created by webgl and 2d canvases. When using, please try to use canvas's own createImage to create image objects.

getContext

TIP

The API usage is as follows: RenderingContext OffscreenCanvas.getContext(string contextType)

  • Functional description: This method returns the drawing context of the OffscreenCanvas

  • Parameters and descriptions: string contextType, Drawing context type, which needs to be consistent with the type passed in when createOffscreenCanvas.

    Legal valueDescription
    webglwebgl type context
    2d2d type context