-> intro

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.

To be considered alpha, maybe forever. APIs are subject to change.



-> usage

As a script:

<script src="/acidlasers.iife.js"></script>
<script>
  const { createLaser } = acidlasers
</script>

As a module:

<script type="module">
  import { createLaser } from '/acidlasers.js'
</script>

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)
})


-> API