title: Canvas
sidebar_label: Canvas
The canvas instance, which can be obtained via SelectorQuery
.
Reference
Methods
cancelAnimationFrame
Cancels the animation frame request added to the plan by requestAnimationFrame (only supported in WebGL).
Reference
(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.
Reference
() => 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.
Reference
() => Image
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
Canvas.createImage |
✔️ |
|
getContext
Returns the Canvas drawing context.
Reference
(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).
Reference
(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 |
✔️ |
|
|