xxxxxxxxxx
83
// 4 Fold Islamic Pattern Tessilated Upon Itself
// Press mouse to change blendMode + increase frame rate
// Press key to toggle background color and show strokes + increase frame rate
let x;
let y = true;
let z = 0;
let a = 0.25;
let b = 255;
function setup() {
createCanvas(400, 400);
blendMode(DIFFERENCE);
background(255);
}
function draw() {
let xy23_top_left= random(360, 400);
let xy23_bottom_right= random(0, 40);
stroke(z);
strokeWeight(1);
frameRate(a);
push();
stroke(z);
strokeWeight(10);
circle(200, 200, random(4, 400));
pop();
push();
fill(0,0,random(255));
//triangle(200, 20, 45, 400, 355, 400);
triangle(200, xy23_bottom_right, 45, xy23_top_left, 355, xy23_top_left);
fill(random(255),random(255),0);
//triangle(20, 200, 400, 45, 400, 355);
triangle(xy23_bottom_right, 200, xy23_top_left, 45, xy23_top_left, 355);
fill(random(255),0,0);
//triangle(200, 380, 45, 0, 355, 0);
triangle(200, xy23_top_left, 45, xy23_bottom_right, 355, xy23_bottom_right);
fill(0,random(255),0);
//triangle(380, 200, 0, 45, 0, 355);
triangle(xy23_top_left, 200, xy23_bottom_right, 45, xy23_bottom_right, 355);
pop();
}
//Change blendMode
function mousePressed () {
blends = [
DIFFERENCE,
EXCLUSION,
MULTIPLY
]
x = random(blends);
blendMode(x);
a += 0.25;
}
//Hide / Show strokes and change background
function keyPressed () {
if(!y){
z = 0;
//y = true;
}
else {
z = 255;
//y = false;
}
a += 0.25;
if (b === 255){
b = 0;
}
else {
b = 255;
}
background(b);
}