0 FPS
// a simple live-coding environment for you from your friend john holdun
// changes to this text field will be applied to the page immediately
// `pixel` is called for every pixel, every frame
// return an array with three values 0-1 for the R, G, and B of that pixel
// `t` is the current time in milliseconds
// `i` is the index of the current pixel
// `x` and `y` are the position of the current pixel on the canvas
// from -1 (top left)
// to 1 (bottom right)
// have fun!
pixel = (t, i, x, y) => {
const ran = Math.sin((i % 13) ** 3 + t * 0.003)
const c = [
x + ran * 0.1,
y + ran * 0.1,
0.5 + ran * 0.3
]
const rcx = Math.sin(t * 0.0005) * 0.2 + 0.5
const rcy = Math.sin(t * 0.0003) * 0.2 + 0.5
const cycle = t % 8701 / 8701
for (let j = 0; j < 3; j++) {
const rot = Math.PI * 2 * (j * 0.3333 + (t * 0.00006))
const cx = rcx + Math.cos(rot) * 0.25
const cy = rcy + Math.sin(rot) * 0.25
const r = 0.02 + 0.01 * Math.sin((cycle + j / 3) * Math.PI * 2)
if (Math.pow(y - cy, 2) + Math.pow(x - cx, 2) <= r) {
c[0] *= 1.2
c[1] *= 1.2
c[2] *= 1.2
break
}
}
return c
}