Convert Processing to p5.js

Please format your code. To do this, edit your post, click on edit, select the text that is actually code and then click in the preformatted text button which looks like this </>. This will format your code for you. Then you need to save the changes in your post.

In the code above, you should not use var but let instead. Now, into your actual issue:

For this line: String[] imgNames = {“emma.jpg”,“obama.jpg”, “clint.jpg”}; needs to be replaced for the p5.js version (aka. the js version) which it would be like this: const imgNames = [“emma.jpg”,“obama.jpg”, “clint.jpg”]; as described here and here.

I just checked the beginning of your code. Please format it to review it deeper.

Kf

2 Likes