‹ pakt23pakt25 ›

pakt24


pact24swoop, 01:00, 1.84MB

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

//pakt24
let index
let n
function setup() {
  const div = select('#sketch')
  const cnv = createCanvas(div.width, div.height)
  cnv.parent('sketch')
  frameRate(60)
  strokeWeight(0.1)
  index = 0
  n = 80
  background(175)
}
function draw() {
  const rx = sin(index * 0.0012)
  const ry = sin(index * 0.0022 + 1)
  const tx = sin(index * 0.0032 + 2) + rx
  const ty = sin(index * 0.0042 + 3) + ry

  noStroke()
  fill(color(255, 255, 255, 5))
  rect(0, 0, width, height)

  noFill()
  stroke(0, 255)
  beginShape()
  vertex(
    (cos((-1.0 / n) * TWO_PI + rx + tx) * 0.49 + 0.5) * width,
    (sin((-1.0 / n) * TWO_PI + ry + ty) * 0.49 + 0.5) * height
  )
  for (let i = 0; i < n; i++) {
    const t = (i / n) * TWO_PI
    const p = createVector((sin(t + rx + tx) * 0.49 + 0.5) * width, (cos(t + ry + ty) * 0.49 + 0.5) * height)
    const q = createVector((cos(t + rx + tx) * 0.49 + 0.5) * width, (sin(t + ry + ty) * 0.49 + 0.5) * height)
    quadraticVertex(p.x, p.y, q.x, q.y)
  }
  endShape()
  index++
}

Ndef(\swoop).play
(
Ndef(\swoop, {var n= 24; Mix({|i|
  var t= i/n;
  var f= SinOsc.ar(0.01, t*0.5pi).exprange(i*22+100, i*44+1000);
  var a= SinOsc.ar(0.05*t, t*2pi, 0.15).max(0);
  var z= RLPF.ar(GrayNoise.ar(a), f*(a+1), 1.4-a-t);
  Pan2.ar(z, LFTri.ar(0.05, t*4, 0.95));
}!n)});
)
Ndef(\swoop).stop