Livecoding environment for vectorial audioreactive visualizations. Mimics laser heads behavior (poorly).
Each head is independent and can trace its own shapes. Every parameter can be a fixed number or a function returning a value, allowing modulation, fft included. Shapes can be combined, morphed, transformed.
open playground →usage
<script src="/acidlasers.iife.js"></script>
<script>const { createLaser } = acidlasers</script>
Or as a module: import { createLaser } from '/acidlasers.js'
The loop is managed from the caller, which has to setup the canvas, advance time and call draw.
eval clears the sketch and runs the code passed to it (resetting options).
clock can be used to sync with time.
const laser = createLaser(canvas)
laser.resize(canvas.clientWidth * devicePixelRatio, canvas.clientHeight * devicePixelRatio, devicePixelRatio)
laser.attach(audioNode) // optional; fft() / wave() read 0 until then
laser.eval(`
new Head('red').draw(circle().scale(t => 0.3 + fft(0) * 0.5).rate(4))
`)
let last = performance.now()
requestAnimationFrame(function frame(now) {
laser.tick((now - last) / 1000)
last = now
requestAnimationFrame(frame)
})