‹ pakt28

pakt29


pact29wrap, 01:00, 1.84MB

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

//pakt29
let cols, rows, index
let oy
let dashes = []
function setup() {
  const div = select('#sketch')
  const cnv = createCanvas(div.width, div.height)
  cnv.parent('sketch')
  frameRate(60)
  colorMode(HSB, 255)
  strokeWeight(20)
  cols = 20
  rows = 20
  index = 0
  oy = 0.025 * height
  dashes = []
}
function draw() {
  background(0)
  for (let x = 0; x < cols; x++) {
    const t = x / cols
    const xx = t * width + (0.5 / cols) * width
    stroke(
      color(
        ((sin(t * PI) * 0.25 + (index * 0.0004 + x * 0.02)) * 255) % 255,
        map(sin(t * PI), -1, 1, 0, 127),
        map(sin(t * PI), -1, 1, 0, 255)
      )
    )
    for (let y = 0; y < rows; y++) {
      dashes[y] =
        sin((index + y) * (sin((index * 0.1 + x * 0.35) * 0.01) * 0.015)) * 10 +
        (sin((index + x) * 0.003) * 40 + 70)
    }
    const off = index % (dashes[0] + dashes[1])
    let yy = height - oy
    let i = 0
    while (yy > -0.5 * height) {
      const d = dashes[i % rows]
      if (i % 2 == 0) {
        const start = constrain(yy + off, oy, height - oy)
        const end = constrain(yy - d + off, oy, height - oy)
        if (start != end) {
          line(xx, start, xx, end)
        }
      }
      yy -= d
      i += 1
    }
  }
  index++
}

Ndef(\wrap).play
(
Ndef(\wrap, {var n= 29; Splay.ar({|i|
  var w= i+LFSaw.ar(i+1*SinOsc.ar(0.1, i/n*2pi, 1, 0.1), 0, 2, 2);
  Saw.ar(340+LFSaw.ar(0.1, i/n, 10, 10).round(20)+i)%Saw.ar(60+w, SinOsc.ar(0.01, i/n*2pi, 2, 2.05))*0.25;
}!n)});
)
Ndef(\wrap).stop