‹ pakt09pakt11 ›

pakt10


pact10rain, 01:00, 1.84MB

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

//pakt10
let index, n;
let rows, cols;
let rowMod, colMod;
let magic;
let grad;
function setup() {
	let div= select('#sketch');
	let cnv= createCanvas(div.width, div.height);
	cnv.parent('sketch');
	frameRate(60);
	noStroke();
	index= 0;
	n= 1200;
	rows= 11;
	cols= 12;
	rowMod= 2;
	colMod= 2;
	magic= 0;
	grad= createGraphics(width, height);
	grad.noStroke();
	for(let r= width; r>0; --r) {
		grad.fill(lerpColor(color(0.2*255, 0.2*255, 0.5*255), color(0, 0, 0), r/width));
		grad.ellipse(width*0.5, height*0.5, r*2.0, r*2.0);
	}
	stroke(255, 255, 0.2*255, 0.85*255);
}
function draw() {
	let r= rows+(sin(index*0.013)*rowMod)+(sin(index*0.00133)*rowMod*0.56);
	let c= cols+(cos(index*0.022)*colMod)+(cos(index*0.00122)*colMod*0.45);
	image(grad, 0, 0);
	for(let i= 0; i<n; i++) {
		let px= (r+i)%width;
		let py= ((c+i)*(i%(magic+1.01)))%height;
		line(px, py, px+(10+sin((index+i)*0.02)), py+(10*cos((index+i)*0.03)));
	}
	rows= rows+(sin(index*0.0004));
	cols= cols+(sin(index*0.0005));
	index++;
	magic= (magic+0.00002)%15;
}

Ndef(\rain).play
(
Ndef(\rain, {
  var n= 30;
  Mix({|i|
    var z= SinOsc.ar(i+1*0.01, 0, 0.001);
    var f= i*100+100+SinOsc.ar(0.0123+z, i/n*2pi).exprange(1, 30);
    var q= SinOsc.ar(0.0234+z, i/n*2pi, 0.3, 0.7);
    var p= SinOsc.ar(0.0345+z, i/n*2pi);
    var a= SinOsc.ar(0.0456+z, i/n*2pi, 0.4, 0.45);
    var x= HPF.ar(BPF.ar(HPF.ar(ClipNoise.ar(2)*Crackle.ar(SinOsc.ar(0.0123+z, i/n*2pi, 0.1, 1.8))), f, q));
    Pan2.ar(x, p, a);
  }.dup(n));
});
)
Ndef(\rain).stop