‹ pakt01pakt03 ›

pakt02


pact02saws, 01:00, 1.84MB

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

//pakt02
//missing dashed lines
let index, n;
let grad;
function setup() {
  let div= select('#sketch');
  let cnv= createCanvas(div.width, div.height);
  cnv.parent('sketch');
  noFill();
  stroke(255, 255, 0, 0.8*255);
  index= 0;
  n= 50;
  grad= createGraphics(width, height);
  grad.noStroke();
  for(let r= width; r>0; --r) {
    grad.fill(lerpColor(color(0.5*255, 0.6*255, 0.7*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= 10+(sin(index*0.016)*2);
  let y= height*0.5+(sin(index*0.010)*50);
  let x3= width-10+(sin(index*0.012)*2);
  let y3= height*0.5+(sin(index*0.014)*50);
  let w= width*0.5;
  let h= height*0.5;
  let spread= map(sin(index*0.0005), -1.0, 1.0, 0.5, 1.5);
  image(grad, 0, 0);
  //let dashes[]= {sin(index*0.0023)*50.0+51.0, cos(index*0.0023)*50.0+51.0};
  //set dash here TODO
  for(let i= 0; i<n; i++) {
    let x1= map(sin(index*0.135+(i*spread)), -1.0, 1.0, 0.1, 0.5);
    let y1= cos((index+i)*0.130+(i*spread));
    let x2= map(sin(index*0.125+(i*spread)), -1.0, 1.0, 0.5, 0.9);
    let y2= cos((index+i)*0.120+(i*spread));
    bezier(x, y, x1*w+w, y1*h+h, x2*w+w, y2*h+h, x3, y3);
  }
  index++;
}
Ndef(\saws).play
(
Ndef(\saws, {Splay.ar(BPF.ar(LeakDC.ar(Saw.ar(SinOsc.ar((0..5)+1*0.02, SinOsc.ar((0..5)+1*101+300, 0, 2pi+SinOsc.ar(0.01, 0, 0.5*pi)), 400, 700))), SinOsc.ar((0..5)+1*0.004, 0, 100, 400), SinOsc.ar((0..5)+1*0.006, 0, 0.4, 0.8)))})
)
Ndef(\saws).stop