draw = {
t
if (source.mediaElement.paused) return;
const width = resolution.width;
const height = resolution.height;
const points = [];
const colors = [];
const point = new THREE.Vector3();
const color = new THREE.Color();
color.setRGB(Math.cos(t * 0.00011) * 0.5 + 1, Math.cos(t * 0.002) * 0.5 + 1, Math.cos(t * 0.003) * 0.5 + 1)
analyser.getByteTimeDomainData(buffers.dataArray);
for (let i = 0; i < buffers.dataArray.length; i++) {
var mod = 1;
var y = ((buffers.dataArray[i] * height / 256.0) - (height/2.0)) * mod;
var x = -width/2 + i * width / buffers.dataArray.length;
points.push(x, y, 0);
colors.push(color.r, color.g, color.b);
}
points.push(width*2, 0, 0);
points.push(width*2, height*2, 0);
points.push(-width*2, height*2, 0);
points.push(-width*2, 0, 0);
buffers.positions.set(buffers.positions.array.slice(points.length));
buffers.positions.set(points, buffers.positions.count * 3 - points.length);
buffers.positions.needsUpdate = true;
buffers.colors.set(buffers.colors.array.slice(colors.length).map(x => x * 0.5), 0);
buffers.colors.set(colors, buffers.colors.count * 3 - colors.length);
buffers.colors.needsUpdate = true;
}