I have imported P5 into a Vue app as follows:
let script = p5 => {
p5.setup = _ => {
this.setup(p5)
}
p5.draw = _ => {
this.draw(p5)
}
}
this.ps = new P5(script)
Everything works fine when I try to access methods like background(0)
(p5.background(0)
) but if I try p5.Vector.fromAngle(angle)
I get:
TypeError: Cannot read property 'fromAngle' of undefined
I believe this is a static method but I need help on how to access it.
According to this answer.
Use p5.constructor.Vector.fromAngle()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With