/* * Simple "graphing calculator" to sketch the parametric curve: * x = t * cos(t) * y = t * sin(t) * albeit, recentered in the middle of the canvas */ float theta = 0.0; void setup() { size(600, 400); noFill(); } void draw() { background(255); beginShape(); for (float t=0; t < width; t += 0.01) { float x = 0.5*width + t * cos(t+theta); float y = 0.5*height + t * sin(t+theta); vertex(x, y); } theta += mouseX * TWO_PI/width; endShape(); }