‹ pakt03pakt05 ›

pakt04


pact04lines, 01:00, 1.84MB

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

//pakt04
let index, n;
let grad;
function setup() {
  let div= select('#sketch');
  let cnv= createCanvas(div.width, div.height);
  cnv.parent('sketch');
  frameRate(60);
  noFill();
  strokeWeight(3);
  index= 0;
  n= 90;
  grad= createGraphics(width, height);
  grad.noStroke();
  for(let r= width; r>0; --r) {
    grad.fill(lerpColor(color(0.5*255, 0.7*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() {
  let x= width*0.5;
  let y= height*0.5;
  let w= width*0.49;
  let h= height*0.49;
  let spreadx= sin(index*0.005)*5;
  let spready= cos(index*0.006)*5;
  let wx= w*(sin(index*0.0125)*0.4+0.6);
  let hy= h*(cos(index*0.01)*0.4+0.6);
  image(grad, 0, 0);
  stroke(255, 255, 255, 0.8*255);
  let xx= 0, yy= 0;
  for(let i= 0; i<n+(sin(index*0.00876)*50); i++) {
    let px= x+(sin((index+(i*spreadx))*0.05)*sin((index+i)*0.01)*wx);
    let py= y+sin((index+(i*spready))*0.04)*sin((index+i)*0.02)*hy;
    if(i==0) {
      xx= px;
      yy= py;
    } else {
      line(xx, yy, px, py);
      xx= px;
      yy= py;
    }
  }
  index++;
}

Ndef(\lines).play
(
Ndef(\lines, {Splay.ar(LeakDC.ar(SinOsc.ar([0.033, 0.066, 0.055, 0.044], SinOsc.ar([0.12, 0.13, 0.11, 0.14]*SinOsc.ar([0.151, 0.152, 0.153, 0.154], SinOsc.ar([5, 4, 3, 2], 0, 2pi), SinOsc.ar([0.043, 0.053, 0.063, 0.073], 0, [80, 60, 40, 100])), SinOsc.ar(([60, 64, 67, 71]+SinOsc.ar([0.024, 0.025, 0.026, 0.027], SinOsc.ar([0.01, 0.02, 0.03, 0.04], 0, pi), 1).round).midicps, 0, 2pi)), 0.2)))})
)
Ndef(\lines).stop