Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
draw({ canvas, context, features }) {
const { width, height } = canvas;
const bufferLength = features.buffer.length;
const buffer = Meyda.windowing(features.buffer, this.windowing);
context.lineWidth = this.strokeWeight;
context.strokeStyle = this.colour;
context.beginPath();
const sliceWidth = width / bufferLength;
let x = 0;
for (let i = 0; i < bufferLength; i += 1) {
const v = (buffer[i] / 100) * this.maxHeight;
const y = (height / 2) + ((height / 2) * v);
if (i === 0) {
context.moveTo(x, y);
} else {
context.lineTo(x, y);