🖼️ Image preloads for web are now available. Get your images faster! See draw_image for more details.

Sketchingpy

Creative coding and interactive science everywhere for everyone: web, desktop, mobile, Jupyter, and more. Open source!

Reference for exit_buffer

Switch from a buffer back to the main canvas. This is part of the reference section.

Purpose

Switch drawing targets such that transformations are still active but commands are sent to the canvas or drawing surface visible to the user, "leaving" the offscreen buffer.

Snippet

Create a buffer with transparent background called "example-buffer" which is 100 pixels wide and 50 pixels tall. Then, draw an ellipse in that buffer.
sketch.create_buffer('example-buffer', 100, 50)
sketch.enter_buffer('example-buffer')
sketch.draw_ellipse(50, 25, 10, 10)
sketch.exit_buffer()

Examples

Availability

Available for all platforms.

See also