pakt02
Built with p5.js and SuperCollider. See /f0blog/pact-februari/
//pakt02 missing dashed lines
let index, n
let grad
function setup() {
const div = select('#sketch')
const cnv = createCanvas(div.width, div.height)
cnv.parent('sketch')
frameRate(60)
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() {
const x = 10 + sin(index * 0.016) * 2
const y = height * 0.5 + sin(index * 0.01) * 50
const x3 = width - 10 + sin(index * 0.012) * 2
const y3 = height * 0.5 + sin(index * 0.014) * 50
const w = width * 0.5
const h = height * 0.5
const 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++) {
const x1 = map(sin(index * 0.135 + i * spread), -1.0, 1.0, 0.1, 0.5)
const y1 = cos((index + i) * 0.13 + i * spread)
const x2 = map(sin(index * 0.125 + i * spread), -1.0, 1.0, 0.5, 0.9)
const y2 = cos((index + i) * 0.12 + 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