Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I call p5.Vector.fromAngle() in Vue JS?

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.

like image 738
khany Avatar asked Sep 18 '25 20:09

khany


1 Answers

According to this answer. Use p5.constructor.Vector.fromAngle()

like image 125
Alexey Khatskelevich Avatar answered Sep 20 '25 12:09

Alexey Khatskelevich