xxxxxxxxxx
67
let x;
let coswave = [];
function setup() {
createCanvas(400, 400);
for (let i = 0; i < width; i++) {
let amount = map(i, 0, width, 0, PI);
coswave[i] = abs(cos(amount));
}
noLoop();
}
function draw() {
background(0);
let y3 = 0;
let y4 = height;
push();
for (let i = 0; i < width; i += 11) {
stroke(255);
strokeWeight(6);
line(i, y3, i, y4);
}
pop();
push();
rectMode(CENTER);
translate(width / 2, height / 2);
rotate(2.35);
noStroke();
rect(0, 0, 250, 250);
pop();
push();
fill(0);
triangle(20, 200, 79, 255, 79, 145);
pop();
push();
fill(0);
triangle(380, 200, 320, 257, 320, 142);
pop();
let y1 = 0;
let y2 = height/100;
push();
for (let i = 0; i < width; i += 11) {
stroke(255);
strokeWeight(pow(2,1.5));
line(i, y3, i, y4);
}
pop();
y1 = y2;
y2 = height;
for (let i = 0; i < width; i +=11) {
push();
stroke(0);
strokeWeight(5*coswave[i]);
line(i+3.2, y3, i+3.2, y4);
pop();
}
}