xxxxxxxxxx
218
//iteration + subiteration
let iter = 1;
let subIter = 1;
//boroughs + bridges
let M = 1;
let B = 2;
let Br = 3;
let Q = 4;
let SI = 5;
let Bri = 0;
//large pedal colors
let c1 = 1;
let c2 = 2;
let c3 = 3;
let c4 = 4;
let c5 = 5;
let itCol = 1;
let subItCol = 1;
//rectangle that covers the screen
let al = 255;
function setup() {
createCanvas(600, 600);
input = createInput();
input.position(225, 10);
iter = int(random(1, 5));
subIter = int(random(2));
print(iter, subIter);
c1 = M;
c2 = B;
c3 = Br;
c4 = Q;
c5 = SI;
let pla = 0;
r = color(255 + pla, 0 + pla, 0 + pla);
g = color(0 + pla, 255 + pla, 0 + pla);
b = color(0 + pla, 0 + pla, 255 + pla);
y = color(255 + pla, 255 + pla, 0 + pla);
p = color(255 + pla, 0 + pla, 255 + pla);
}
function draw() {
background(255);
scrambleIt(iter);
scrambleSubIter(subIter);
noStroke();
push();
fill(itCol);
rect(0, 0, width, height);
pop();
push();
fill(subItCol);
ellipse(width/2, height/2, 500, 500);
pop();
if(Bri == 0){
briCol = 0;
}
if(Bri == 1){
briCol = 128;
}
if(Bri == 2){
briCol = 255;
}
push();
fill(briCol);
ellipse(width/2, height/2, 100, 100);
pop();
scrambleB(iter);
pedal(0, 3, c1);
pedal(0, 1.5, 'black');
pedal(72, 3, c2);
pedal(72, 1.5, 'white');
pedal(72 * 2, 3, c3);
pedal(72 * 2, 1.5, 'black');
pedal(72 * 3, 3, c4);
pedal(72 * 3, 1.5, 'black');
pedal(72 * 4, 3, c5);
pedal(72 * 4, 1.5, 'white');
//comment this out to negate the password
fill(0, 0, 0, al)
rect(0, 0, width, height);
}
//burough scramble
function scrambleB(u){
if(u == 1){
M = r;
B = g;
Br = b;
Q = y;
SI = p;
c1 = M;
c2 = Br;
c3 = B;
c4 = SI;
c5 = Q;
}
if(u == 2){
M = p;
B = r;
Br = g;
Q = b;
SI = y;
c1 = Br;
c2 = M;
c3 = Q;
c4 = SI;
c5 = B;
}
if(u == 3){
M = y;
B = p;
Br = r;
Q = g;
SI = b;
c1 = SI;
c2 = Q;
c3 = Br;
c4 = M;
c5 = B;
}
if(u == 4){
M = b;
B = y;
Br = p;
Q = r;
SI = g;
c1 = M;
c2 = SI;
c3 = Q;
c4 = B;
c5 = Br;
}
}
function scrambleIt(it){
if(it == 1){
itCol = 'cyan';
}
if(it == 2){
itCol = 'pink';
}
if(it == 3){
itCol = 'magenta';
}
if(it == 4){
itCol = 'orange';
}
}
function scrambleSubIter(itt){
if(itt == 0){
subItCol = 255;
}
if(itt == 1){
subItCol = 0;
}
}
function pedal(rot, scal, c){
push();
translate(width/2, height/2);
angleMode(DEGREES);
rotate(rot);
scale(scal);
fill(c);
bezier(0, 0, -40, -60, 40, -60, 0, 0);
pop();
}
function keyPressed(){
if(keyCode === ENTER){
if(input.value() == "heyThere"){
al = 0;
}
else{
al = 255;
}
}
}