/** "modulo" * (cc) 2006 douglas edric stanley * http://creativecommons.org/licenses/by/2.5/ * This work is licensed under the Creative Commons Attribution2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA. */ int x, y; void setup() { size(256,256); // pink lines stroke(255,0,255); } void draw() { // white background background(255); x += 1; // increment x position x %= width; // this is the modulo line(x,0,x,height); // draw vertical line with x if (x==0) y += 1; // if x has moved back to 0, increment y position y %= height; // this is the modulo line(0,y,width,y); // draw horizontal line with y }