Canvas
The canvas instance, which can be obtained via SelectorQuery
.
Methods
cancelAnimationFrame
Cancels the animation frame request added to the plan by requestAnimationFrame (only supported in WebGL).
(requestID: number) => void
Property | Type |
---|---|
requestID | number |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Canvas.cancelAnimationFrame | ✔️ |
createImageData
Creates an ImageData object. Only supported for use in 2D Canvas.
() => ImageData
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Canvas.createImageData | ✔️ |
createImage
Creates an image object. Supports use in 2D Canvas and WebGL Canvas, but does not support mixing 2D and WebGL methods.
() => Image
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Canvas.createImage | ✔️ |
getContext
Returns the Canvas drawing context.
(contextType: string) => RenderingContext
Property | Type |
---|---|
contextType | string |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Canvas.getContext | ✔️ |
requestAnimationFrame
Executed upon the next redrawing (only supported in WebGL).
(callback: (...args: any[]) => any) => number
Property | Type | Description |
---|---|---|
callback | (...args: any[]) => any | 执行的 callback |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Canvas.requestAnimationFrame | ✔️ |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Canvas.cancelAnimationFrame | ✔️ | ||
Canvas.createImageData | ✔️ | ||
Canvas.createImage | ✔️ | ||
Canvas.getContext | ✔️ | ||
Canvas.requestAnimationFrame | ✔️ |