EXPO2025
https://gyazo.com/0410138451c15db9e410aae7d0ce9da1
code:osaka.js
const spots = []
function newSpot(deg, r) {
return {
deg,
dx: random(-10, 10),
dy: random(-10, 10),
r,
r2: r*random(0.5,1.5),
vx: random(-20, 20) / 10,
vy: random(-20, 20) / 10,
}
}
function setup() {
createCanvas(640, 640);
colorMode(RGB)
angleMode(DEGREES)
noStroke()
for (i = 0; i < 360;) {
const r = random(30, 150)
spots.push(newSpot(i, r))
i += r / 4
}
}
function move(spot) {
spot.vx = random(-40, 40) / 10 - spot.dx / 2
spot.vy = random(-40, 40) / 10 - spot.dy / 2
spot.dx += spot.vx
spot.dy += spot.vy
spot.deg += .3
}
function origin(spot) {
return {
ox: width / 2 + cos(spot.deg) * width / 3,
oy: height / 2 + sin(spot.deg) * height / 3,
}
}
function drawSpot(spot) {
fill(color(255, 0, 0))
const {
ox,
oy
} = origin(spot)
ellipse(ox + spot.dx, oy + spot.dy, spot.r,spot.r2);
}
function drawEye(spot) {
const {
ox,
oy
} = origin(spot)
const {
r
} = spot
const dx = norm(mouseX - ox, 0, width) * r
const dy = norm(mouseY - oy, 0, height) * r
fill('white')
ellipse(ox + dx / 3, oy + dy / 3, r / 2);
fill('black')
ellipse(ox + dx / 2, oy + dy / 2, r / 4);
}
function draw() {
background(0)
spots.forEach(spot => {
drawSpot(spot)
move(spot)
});
})
}