Clear one shape every draw loop but not another.

edited December 2014 in How To...

Here's an example sketch to explain the question:

float x1 = 0;
float y1 = 0;

void setup () {

void draw() {
background(255); // I want this to effect only one of the rectangles
rect(x1, 200, 10, 10);
x1 += 1;
rect(200, y1, 10, 10); // want to see the trail of each shape drawn every loop
y1 += 1;

How would I write this code so you the second set of rectangles being drawn every loop, but appear to remove all of the previous shapes drawn from the first rectangle? I want the first rect shape to appear to be moving across the screen while the second rect appears to be dragging a trail across the screen.



Sign In or Register to comment.