Porting a project from Processing to p5.js, getting stuck on an error

I’ve been working on getting a Processing project ported to p5.js, mostly just to figure out how to make it work. I’ve been stuck on an error ("There’s an error due to “MakeTriangle” not being defined in the current scope ") that I can’t seem to get past, and I think it has something to do with how I’m using an included .js file with a constructor. My experience is so-so with this, so I’d appreciate any thoughts on what I’m doing wrong. You can find the project here: https://www.openprocessing.org/sketch/1048797

Thanks!

If you got an already working sketch why don’t you post that as well? :roll_eyes:

function display() :arrow_right: display()

And in a class you have to use ‘this’ on every variable like strokeWeight(this.tempWeight);

1 Like

The working sketch is in Processing - do I just copy/paste the code here?

I’ll try your suggestions. Thanks!

Yup! But make sure to highlight it and hit CTRL + SHIFT + C.

You can also host it on OpenProcessing.org and switch to Mode Pjs at its right panel.

With some luck it’s gonna even run there online.

Well, both suggestions helped and it works! If you go to the same link in the original post, you’ll see the results. Thank you!