Submitted by michael on Sun, 04/05/2020 - 12:20 Description Drawing mostly-transparent shapes to the canvas as fast as possible. Source Code let sketch = function(p) { let canvas = null; function initialize() { p.background(0); } function buttons() { $("<button>Start</button>").click(function(){p.loop();}).appendTo("#controls"); $("<button>Stop</button>").click(function(){p.noLoop();}).appendTo("#controls"); $("<button>Step</button>").click(function(e) { p.redraw(); p.noLoop();}).appendTo("#controls"); $("<button>Clear</button>").click(function(e) { p.background(0); }).appendTo("#controls"); $("<button>Restart</button>").click(function(e) { initialize(); p.loop(); }).appendTo("#controls"); $("<button>Save</button>").click(function(e) { p.saveCanvas(canvas, 'negativespace.net.png','png'); }).appendTo("#controls"); } p.setup = function() { canvas = p.createCanvas($('#canvas_container').width(), 610); initialize(); buttons(); p.colorMode(p.RGBA, 255); p.noStroke(); p.loop(); }; p.draw = function() { for(var i = 0; i < 50; i++) { var c = p.color(p.random(0,255), p.random(0,128), p.random(0,255), 15); p.fill(c); p.rect(p.random(0, p.width)-50, p.random(0, p.height)-50, 100, 100); } }; }; let myp5 = new p5(sketch, 'canvas_container'); Gallery