Skip to content

Wall of eyes

Caution: eyes blinking may startle some.

A wall of eyes, staring at the mouse. Every now and then, they blink.

function setup() {
  createCanvas(windowWidth, windowHeight)
  seed = random(100000)
}
function windowResized() {
  resizeCanvas(windowWidth, windowHeight)
}
let seed
let time = 0
let delay = 6
let bw = 20000

function draw() {
  randomSeed(seed)
  background(random(200, 255), random(200, 255), random(200, 255));
  time += deltaTime/1000
  for (let y = 0; y < height + 15; y += 40) {
    for (let x = (y%80 == 0 ? 15 : 0); x < width + 15; x += 40) {
      let s = random(20, 30)
      fill(255)
      circle(x, y, s)
      fill(0)
      let a = (((time - delay) / bw * 60 - random()) % 1) * bw
      if (a < 60) {
        push()
        beginClip()
        circle(x, y, s)
        endClip()
        circle(x, y - abs(a - 30), s)
        pop()
      }
      let t = min(s/4 / dist(mouseX, mouseY, x, y), 1)
      circle(
        (mouseX - x) * t + x,
        (mouseY - y) * t + y,
        8)
    }
  }
}

(Originally seen at https://editor.p5js.org/bojidar-bg/sketches/sq-h7Ezgt)

Experiments tagged p5 (20/85)

Experiments tagged interactive (7/26)

Experiments on this site (20/85)