‹ pakt02pakt04 ›

pakt03


pact03varsaws, 01:00, 1.84MB

Built with p5.js and SuperCollider. See /f0blog/pact-februari/

//pakt03
let index, n
let grad
function setup() {
  const div = select('#sketch')
  const cnv = createCanvas(div.width, div.height)
  cnv.parent('sketch')
  frameRate(60)
  noFill()
  noStroke()
  index = 0
  n = 50
  grad = createGraphics(width, height)
  grad.noStroke()
  for (let r = width; r > 0; --r) {
    grad.fill(
      lerpColor(color(0.7 * 255, 0.6 * 255, 0.5 * 255), color(0, 0, 0), r / width)
    )
    grad.ellipse(width * 0.5, height * 0.5, r * 2.0, r * 2.0)
  }
}
function draw() {
  const x = width * 0.5
  const y = height * 0.5
  const w = width * 0.4
  const h = height * 0.4
  const spreadx = sin(index * 0.005)
  const spready = sin(index * 0.011)
  const phaseshift = sin(index * 0.001) * TWO_PI
  const wx = w * (sin(index * 0.004) * 0.45 + 0.55)
  const hy = h * (sin(index * 0.004) * 0.45 + 0.55)
  image(grad, 0, 0)
  for (let i = 0; i < n; i++) {
    const r = (i / n) * 30 + 1.0
    let p = 0
    fill(255, 255, 255, 0.5 * 255)
    ellipse(
      x + sin((index + i * spreadx) * 0.05 + p) * wx,
      y + cos((index + i * spready) * 0.05 + p) * hy,
      r * 2,
      r * 2
    )
    p = p + phaseshift
    fill(0, 0, 255, 0.5 * 255)
    ellipse(
      x + sin((index + i * spreadx) * 0.05 + p) * wx,
      y + cos((index + i * spready) * 0.05 + p) * hy,
      r * 2,
      r * 2
    )
    // p= p+phaseshift;
    // fill(0, 255, 0, 0.5*255);
    // ellipse(x+(sin((index+(i*spreadx))*0.05+p)*wx), y+cos((index+(i*spready))*0.05+p)*hy, r*2, r*2);
    // p= p+phaseshift;
    // fill(255, 0, 0, 0.5*255);
    // ellipse(x+(sin((index+(i*spreadx))*0.05+p)*wx), y+cos((index+(i*spready))*0.05+p)*hy, r*2, r*2);
    // p= p+phaseshift;
    // fill(0, 0, 0, 0.5*255);
    // ellipse(x+(sin((index+(i*spreadx))*0.05+p)*wx), y+cos((index+(i*spready))*0.05+p)*hy, r*2, r*2);
  }
  index++
}

Ndef(\varsaws).play
(
Ndef(\varsaws, {GVerb.ar(CombC.ar(VarSaw.ar(SinOsc.ar([0.1, 0.11], 0, 5, 100+SinOsc.ar([0.05, 0.055], 0, 50, 50).round(50)), 0, SinOsc.ar([0.2, 0.22], 0, 0.5, SinOsc.ar([0.3, 0.33], 0, 0.1, 0.5)), 0.1), 1.01, SinOsc.ar([0.4, 0.44], 0, 0.01, 1), 8), 80, 5, 0.9)})
)
Ndef(\varsaws).stop