Convert Processing to p5.js

**PImage img;**

Replace with

let  img;
for (int i = 0; i < strokesPerFrame; i++) 

Replace with:

for (let i = 0; i < strokesPerFrame; i++) 

This is not recommended: color = img.pixels[index]; Color is a reserved word in Processing. This will work but will make your code hard to read. I suggest to use some other name. For instance, pixColor.

pushMatrix and pop matrix needs to be replaced by push and pop resp.

function paintDot(color strokeColor, int strokeThickness)

replace with

function paintDot(let strokeColor, let strokeThickness)

Similarly you need to fix paintStroke.

Implement the changes and try it out to see if it works. If you get any error, check the proper reference. If something is not clear, just ask.

Kf

2 Likes