‹ pakt11pakt13 ›

pakt12


pact12waves, 01:00, 1.84MB

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

//pakt12
let index;
let n;
let grad;
function setup() {
  let div= select('#sketch');
  let cnv= createCanvas(div.width, div.height);
  cnv.parent('sketch');
  frameRate(60);
  noStroke();
  index= 0;
  grad= createGraphics(width, height);
  grad.noStroke();
  for(let r= width; r>0; --r) {
    grad.fill(lerpColor(color(0.3*255, 0.3*255, 0.3*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.7*255);
}
function draw() {
  image(grad, 0, 0);
  n= sin(index/frameRate()*0.125)*150+200;
  let x= 0, y= 0, xx= 0, yy= 0;
  beginShape();
  for(let i= 0; i<n; i++) {
    if(i==0) {
      x= 0.5/n*width;
      y= height*0.5;
    } else if(i%3==1) {
      xx= i/n*width;
      yy= (height*0.25)+(sin((index+(i+3))*(sin((index+1)*0.014)*0.02))*(sin((index+i)*0.015))*(0.225*height));
      vertex(x, y);
      x= xx;
      y= yy;
    } else if(i%3==2) {
      xx= i/n*width;
      yy= (height*0.50)+(sin((index+(i+2))*(sin((index+2)*0.012)*0.02))*(sin((index+i)*0.020))*(0.225*height));
      vertex(x, y);
      x= xx;
      y= yy;
    } else {
      xx= i/n*width;
      yy= (height*0.75)+(sin((index+(i+1))*(sin((index+3)*0.010)*0.02))*(sin((index+i)*0.025))*(0.225*height));
      vertex(x, y);
      x= xx;
      y= yy;
    }
  }
  vertex(width*0.99, height*0.5);
  endShape();
  index++;
}

Ndef(\waves).play
(
Ndef(\waves, {var n= 3; Mix({|i|
  var z= VarSaw.ar(i+1*0.01, 0, 0.5, 5, VarSaw.ar(i+1*10, 0, 0.5, 0.5, 10));
  var w= VarSaw.ar(i+1*VarSaw.ar(i+1*0.001, 0, 0.5, z, z*z), 0, 0.5, 0.5, 0.5);
  Pan2.ar(
    SinOsc.ar(0, VarSaw.ar(i+1*w*100, 0, w, 2pi), VarSaw.ar(i+1*w*0.1, 0, w, 0.5)),
    i.linlin(0, n-1, -0.9, 0.9),
    2/n
  )
}!n)});
)
Ndef(\waves).stop