createGraphics()
Creates an additional canvas that can be overlaid on any other existing canvases
Last updated
Creates an additional canvas that can be overlaid on any other existing canvases
Last updated
the createGraphics()
function is used to create an off-screen graphics buffer that can be manipulated and then displayed on the main canvas.
The buffer is displayed on the main canvas using image(buffer, x, y)
.
Using createGraphics()
allows you to create complex graphics that can be drawn off-screen before being displayed on the main canvas. This is particularly useful when you want to create more complex animations or drawings that would be difficult to create directly on the main canvas.
Below program uses one background under setup() and one under draw()
Find these documents helpful? Let the people who made them help your child learn to code at Strivemath!
We'd love to hear your Feedback/Comments here.
Inputs | Description |
---|---|
w
width of the off-screen buffer
h
height of the off-screen buffer