‹ pakt08pakt10 ›

pakt09


pact09snow, 01:00, 1.84MB

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

//pakt09
//ok
let index, n, m;
let rows, cols;
let magic;
let grad;
function setup() {
  let div= select('#sketch');
  let cnv= createCanvas(div.width, div.height);
  cnv.parent('sketch');
  noStroke();
  index= 0;
  n= 1000;
  m= 0;
  rows= 3;
  cols= 4;
  magic= 50;
  grad= createGraphics(width, height);
  grad.noStroke();
  for(let r= width; r>0; --r) {
    grad.fill(lerpColor(color(0.5*255, 0.5*255, 0.5*255), color(0, 0, 0), r/width));
    grad.ellipse(width*0.5, height*0.5, r*2.0, r*2.0);
  }
  fill(255, 255, 255, 0.85*255);
}
function draw() {
  let w= width;
  let h= height;
  image(grad, 0, 0);
  if(m<n) {
    m= m+1;
  }
  for(let i= 0; i<m; i++) {
    let px= (rows+i)%w;
    let py= ((cols+i)*(i%magic))%h;
    rect(px, py, 8*sin((index+i)*0.012), 8*cos((index+i)*0.011));
  }
  magic= magic+(sin(index*0.001)*0.01);
  rows= rows+(sin(index*0.0004));
  cols= cols+(sin(index*0.0005));
  index++;
}
Ndef(\snow).play
(
Ndef(\snow, {
  Mix({|i|
    var m= SinOsc.ar(0.005, i/5*2pi, 2pi);
    var p= WhiteNoise.ar(SinOsc.ar(i*5000+5000)*SinOsc.ar(i*500+500)*SinOsc.ar(i*50+50)*SinOsc.ar(i*5+5));
    Pan2.ar(SinOsc.ar(p, p*m, p), p, 0.5);
  }.dup(5));
});
)
Ndef(\snow).stop