> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.sM63Dn$dGeO/rev.1489
 * 
 * authors: 
 *   Leo

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



//generic isometric stack!!!!!!!!!!!!!!!!!!
//move mouse left/right/up/down
//click for outlines (which are pseudo-shading, lol)
int squareNum, randDivide;
float rot, hx, hy;
boolean outlinesOn;
void setup(){
    size(300, 300);
    background(255);
    colorMode(HSB);
    rectMode(CENTER);
    hx = width / 2;
    hy = height / 2;
    squareNum = 100;
    noStroke();
    randDivide = random(0, 20);
}

void draw(){
    noStroke();
    fill(255, 0, 0, 50);
    rect(hx, hy, width, height);
    msy = map(mouseY, 0, height, -200, 200);
    for(int i = 0; i < squareNum; i+= 1){
        if (outlinesOn){
            stroke(huesq, satsq, valuesq - 200, 100);
            strokeWeight(5);
        } else {
            noStroke();
        }
        int i2 = i * 2;
        pushMatrix();
        translate(hx + cos(i/randDivide)*20, hy + hy/1.6 - i2);
        scale(map(i, 0, squareNum, 1, 0.5), 0.3 - i/900);
        rotate(rot + i/msy);
        int huesq = map(i, 0, squareNum, 0, 255);
        int satsq = 255 - i2;
        int valuesq = map(i, 0, squareNum, 255, 255);
        fill(huesq, satsq, valuesq, 255);
        rect(0, 0, 100, 100);
        popMatrix();
    }
    rot += map(mouseX, 0, width, -0.1, 0.1);
}

void mousePressed(){
    randDivide = random(0, 20);
    if (!outlinesOn){
        outlinesOn = true;
    } else {
        outlinesOn = false;
    }
}