🧪 Version 0.2.2 is our alpha release candidate. Please send us bug reports and suggestions!

Sketchingpy

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

Reference for create_buffer

Create an off-screen buffer. This is part of the reference section.

Purpose

Create an "offscreen buffer" which can be used to save the results of drawing operations to memory, making them much faster to draw again later or in repetition. Note that buffers with opaque backgrounds may be more efficient in some renderers than buffers with transparent backgrounds.

Snippet

Create a buffer with transparent background called "example-buffer" which is 100 pixels wide and 50 pixels tall.
sketch.create_buffer('example-buffer', 100, 50)

Parameters

  • name: The name of the buffer to create within the sketch.
  • width: Width of the buffer in pixels.
  • height: Height of the buffer in pixels.
  • background: Optional color to use for the background of the buffer or None if fully transparent background. Defaults to None if not given.

Examples

Availability

Available for all platforms.

See also