xxxxxxxxxx
36
function setup() {
createCanvas(400, 400)
// noLoop()
frameRate(2)
num_triangles = 1
}
function draw() {
background(220)
noFill()
for (let i = 0; i < num_triangles; i++) {
p = []
for (let j = 0; j < 3; j++) {
r = random()
if (r < 0.25) {
p.push({x: random(width), y: 0})
} else if (r < 0.50) {
p.push({x: 0, y: random(height)})
} else if (r < 0.75) {
p.push({x: random(width), y: height})
} else {
p.push({x: width, y: random(height)})
}
}
if (random() < 0.1) {
fill(random(255), random(255), random(255))
} else {
noFill()
}
// stroke(int(random(1, 10)))
stroke(15)
triangle(p[0].x, p[0].y, p[1].x, p[1].y, p[2].x, p[2].y)
}
num_triangles++
}