Using ES6 I need to instantiate Particle constructor. Invoking constructor through default export I’m getting an error -> p.Particle is not a constructor
I’ve scaffolded playground – link
'use strict';
import P5 from 'p5';
const sketch = (p5) => {
const AMOUNT = 100;
const p = p5;
let particles = [];
p.setup = () => {
p.createCanvas(p.windowWidth, p.windowHeight);
p.pixelDensity(1);
const x = Array(AMOUNT).fill().map((x, index) => new p.Particle(320, 240));
p.background(51);
};
p.draw = () => {
p.background(p.mouseX, 100, 100);
particles.forEach((x) => {
x.update();
x.show();
});
};
};
new P5(sketch);