pakt01
Built with p5.js and SuperCollider. See /f0blog/pact-februari/
//pakt01 ok - but no changing background
let index, n
let grad
function setup() {
const div = select('#sketch')
const cnv = createCanvas(div.width, div.height)
cnv.parent('sketch')
frameRate(60)
noFill()
strokeCap(SQUARE)
index = 0
n = 75
grad = createGraphics(width, height)
grad.noStroke()
for (let r = width; r > 0; --r) {
grad.fill(lerpColor(color(255, 255, 0.65 * 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 = width * 0.5
const y = height * 0.5
const w = width * 0.25
const h = height * 0.25
const yellow = sin(index * 0.0005) * 0.3 + 0.65
image(grad, 0, 0)
for (let i = 0; i < n; i++) {
const xx = x + cos(i * 0.2) * w
const yy = y + sin(i * 0.15) * h
const start = cos(index * ((i + 1) * 0.00006)) * 2 * PI
const end = sin(index * (i * 1 * 0.00008)) * 2 * PI
const size = sin(index * 0.01 + i) * 50 + 58
stroke((xx / width) * 255, (yy / height) * 255, yellow * 255, (end / 2) * PI * 255)
strokeWeight(i / 8.0 + 4.0)
arc(xx, yy, size * 2, size * 2, start, start + end)
}
index++
}
Ndef(\moreSines).play
(
Ndef(\moreSines, {LeakDC.ar(Splay.ar(SinOsc.ar((0..20)/70+0.01, SinOsc.ar((0..20)+1*50+50+SinOsc.ar((0..20)+1/30), 0, 2pi), SinOsc.ar((0..20)+1/80, (0..20)/40, 0.2).max(0))))})
)
Ndef(\moreSines).stop