--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/misc/blinky_squares.pjs Mon Sep 02 02:22:21 2013 -0700
@@ -0,0 +1,47 @@
+
+void setup() {
+ size( 510, 510 );
+ smooth();
+
+ background( 200 );
+}
+
+void draw() {
+ if ( mousePressed ) {
+ rects(1);
+ }
+ else {
+ rects(0);
+ }
+}
+
+void rects( int rand ) {
+ int cwidth = 50;
+ int cheight = 50;
+
+ int curwidth = cwidth-(cwidth/5);
+ int curheight = cheight-(cwidth/5);
+
+ noStroke();
+
+ for ( int y = cheight/5; y <= height; y += cheight ) {
+ for ( int x = cwidth/5; x <= width; x += cwidth ) {
+ if ( rand == 1 ) {
+ fill( random(180,220) );
+ }
+ else {
+ fill( 210 );
+ }
+
+ if ( (mouseX > x) && (mouseX < x + curwidth) &&
+ (mouseY > y) && (mouseY < y + curheight) ) {
+
+ // mouse is inside rectangle
+ }
+ else {
+ rect( x, y, curwidth, curheight );
+ }
+ }
+ }
+}
+