2D canvas opacity
The optional alpha parameter of a 2D canvas's getContext() method sets whether the canvas has an alpha transparency channel. If set to false, then this permits the browser to optimize compositing for an opaque canvas.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
getContext (2d context options alpha parameter) | 32 | 79 | 30 | | 32 | |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Use cases
-
Using 2D canvas opacity
The optional alpha parameter of a 2D canvas's getContext() method sets whether the canvas has an alpha transparency channel. If set to false, then this permits the browser to optimize compositing for an opaque canvas.
Cautions
- Limited browser support. Check compatibility before use.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.