Glitch butterfly
Made for Genuary 2025, January 27, prompt: Make something with no randomness or trigonometry.
function setup() {
createCanvas(600, 600);
}
let mod = (x,y) => (x%y + y)%y
function draw() {
blendMode(BLEND)
background(255);
blendMode(MULTIPLY)
noStroke()
translate(width/2, height/2)
let ss = 0.2 + abs(frameCount / 141 % 2 - 1) * 0.8
let s = ss + abs(frameCount / 30 % 2 - 1) * (1 - ss)
for (let i = -10; i <= 10; i ++) {
for (let j = -10; j <= 10; j ++) {
fill(255, 255, 0)
rect(i * (abs(i)*1.4 + (-j%4.3)) * s + min(i*2,0), j * (abs(j)*1.4 + mod(-i,4)) + min(j*2,0) - abs(i)*s, abs(i*2) * s, abs(j*2))
}
}
translate(3, 3)
for (let i = -10; i <= 10; i ++) {
for (let j = -10; j <= 10; j ++) {
fill(0, 255, 255)
rect(i * (abs(i)*1.4 + (-j%4)) * s + min(i*2,0), j * (abs(j)*1.4 + mod(-i,3)) + min(j*2,0) - abs(i)*s, abs(i*2) * s, abs(j*2))
}
}
for (let i = -10; i <= 10; i ++) {
for (let j = -10; j <= 10; j ++) {
fill(255, 0, 255)
rect(i * (abs(i)*1.4 + (-j%4.5)) * s + min(i*2,0), j * (abs(j)*1.4 + mod(i,5)) + min(j*2,0) - abs(i)*s, abs(i*2) * s, abs(j*2))
}
}
}(Originally seen at https://editor.p5js.org/bojidar-bg/sketches/XZgizQqBV and https://mastodon.social/@bojidar_bg/113901454083757227)
Browse more articles?
← Square spiral Experiments tagged p5 (26/85) Sunshine →
← Running square Experiments tagged critter (2/6) Gear face →
← Gradient gears Experiments tagged genuary (2/2) →|
← Square spiral Experiments on this site (26/85) Sunshine →