dynamicFuzz
mathober prompt - triangle.
let a, b, c, d, t, f;
let x1, y1, x2, y2, x3, y3;
function setup() {
createCanvas(windowWidth, windowHeight);
noFill();
setV();
strokeWeight(0.1);
stroke(0, 0, 0, 100);
angleMode(DEGREES);
}
function draw() {
translate(width / 2, height / 2);
t = frameCount / 2;
stroke(255 * abs(sin(t)), 255 * abs(sin(t)), 255 * abs(sin(t)), 100);
f = (min(width, height) / 8) * cos(t / 4);
for (let i = 0; i < 500; i++) {
rotate(i);
x1 = f * sin(a * x1) + (f / 2) * cos(x2 * y1) * sin(a + x1);
y1 = f * cos(a * y1) + f * sin(x2 * y2) + ((b * f) / 2) * sin(x3 * c);
x2 = f * sin(b * x2) + f * cos(x1 + y3) + ((d * f) / 2) * cos(x2 * c);
y2 = (f / a) * cos(b * y2) * sin(x2 * y3) + ((a * f) / 2) * sin(x1 * a);
x3 = f * sin(c * x3) * cos(x3 * b * y1) + ((c * f) / 2) * sin(x1 * y2);
y3 =
f * cos(c * y3 + t) + f * sin(x1 + a * y2) + ((d * f) / 2) * sin(y1 * d);
triangle(x1, y1, x2, y2, x3, y3);
}
}
function mousePressed() {
setV();
}
function setV() {
a = random(-3, 3);
b = random(-3, 3);
c = random(-4, 4);
d = random(-1, 1);
x1 = random(-width / 2, width / 2);
y1 = random(-height / 2, height / 2);
x2 = random(-width / 2, width / 2);
y2 = random(-height / 2, height / 2);
x3 = random(-width / 2, width / 2);
y3 = random(-height / 2, height / 2);
}