xxxxxxxxxx
84
let block = 40;
let r = block / 4;
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
colorMode(HSB, 100);
noStroke();
background(0, 0, 100);
//fill(100);
//background('#e0ebaf');
//background(255);
for (let j = 0; j < height; j = j + block) {
for (let i = 0; i < width; i = i + block / 2) {
if ((i % ((block / 2) * 2)) * 2 == j % (block * 2)) {
whiteArrow(i, j);
} else {
colorArrow(i, j);
}
}
}
}
function draw() {
// put drawing code here
/*
for(let j = 0; j < height ; j=j+block) {
for(let i = 0; i < width; i=i+block){
if(i%(block*2)==j%(block*2)) {
drawVertical(i,j);
} else {
drawHorizontal(i, j);
}
}
}
*/
}
function whiteArrow(x, y) {
push();
translate(x, y);
fill(0, 0, 100);
beginShape();
vertex(-r, -r);
vertex(0, 0);
vertex(r, -r);
vertex(r, block - r);
vertex(0, block);
vertex(-r, block - r);
endShape();
strokeWeight(1);
stroke(random(0, 100), 30, 100);
// stroke(0, 0, 50);
line(0, 0, 0, block);
pop();
}
function colorArrow(x, y) {
push();
translate(x, y);
// fill(0, 0, 50);
fill(random(0, 100), 30, 100);
beginShape();
vertex(-r, -r);
vertex(0, 0);
vertex(r, -r);
vertex(r, block - r);
vertex(0, block);
vertex(-r, block - r);
endShape();
strokeWeight(1);
stroke(0, 0, 100);
line(0, 0, 0, block);
pop();
}