‹ pakt13pakt15 ›

pakt14


pact14interfere, 01:00, 1.84MB

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

//pakt14
let index
let spread
let spreadx, spready
let n
let grad
function setup() {
  const div = select('#sketch')
  const cnv = createCanvas(div.width, div.height)
  cnv.parent('sketch')
  frameRate(60)
  index = 0
  n = 100
  grad = createGraphics(width, height)
  grad.noStroke()
  for (let r = width; r > 0; --r) {
    grad.fill(
      lerpColor(color(0.5 * 255, 0.5 * 255, 0.6 * 255), color(0, 0, 0), r / width)
    )
    grad.ellipse(width * 0.5, height * 0.5, r * 2.0, r * 2.0)
  }
  fill(255)
  noStroke()
}
function draw() {
  clear()
  background(0)
  blendMode(DIFFERENCE)
  let x = 0
  let y = 0
  for (let i = 0; i <= n; i++) {
    spreadx = sin((i + index) * 0.011) * sin((i + index) * 0.013)
    spready = sin((i + index) * 0.012) * sin((i + index) * 0.014)
    spread = spreadx * spready * 0.25 + cos((index + i) * 0.001)
    let yy = sin((i + index) * 0.012 + spready)
    let hh = yy * cos(index * 0.013)
    let xx = cos((i + index) * 0.014 + spreadx)
    let ww = xx * sin(index * 0.015)
    yy = yy * (height * spread) + height * 0.5
    xx = xx * (height * spread) + height * 0.5
    hh = hh * (height * spread) + height * 0.5
    ww = ww * (height * spread) + height * 0.5
    if (i == 0) {
      x = xx
      y = yy
    } else if (i % 5 == 1) {
      bezier(x, y, xx, yy, ww, hh, ww, hh)
      x = ww
      y = hh
    } else if (i % 5 == 2) {
      bezier(x, y, yy, xx, hh, ww, hh, ww)
      x = hh
      y = ww
    } else if (i % 5 == 3) {
      bezier(x, y, xx, yy, hh, ww, hh, ww)
      x = hh
      y = ww
    } else if (i % 5 == 4) {
      bezier(x, y, yy, xx, ww, hh, ww, hh)
      x = ww
      y = hh
    } else {
      x = yy
      y = xx
    }
  }
  blendMode(LIGHTEST)
  image(grad, 0, 0)
  index++
}

Ndef(\interfere).play
(
Ndef(\interfere, {var a= #[3, 1, 5, 2]; Limiter.ar(Splay.ar(Formlet.ar(LFPulse.ar(a*100+SinOsc.ar(a, 0, a/20), 0, SinOsc.ar(a/10, 0, 0.45, 0.5), LFPulse.ar(a+a, 0, SinOsc.ar(a/10, 0, 0.45, 0.5), 0.1)), a*100+LFPulse.ar(a/2, 0, 0.5, a*SinOsc.ar(a/100, 0, 150, 200)), SinOsc.ar(a/30, 0, 0.01, 0.0125), SinOsc.ar(a/60, 0, 0.05, 0.055), 0.2)))});
)
Ndef(\interfere).stop