I mentioned in my last Processing post that there was a problem with the mask being resized constantly. As the mask was being resized multiple times each frame it soon lost its quality and its masking abilities slowly got worse as the mask got more stretched and blurred.
To get around this I moved the ‘mask = loadImage(“mask.jpg”);’ line from the setup to the draw. With the line in the setup, the mask was loaded once at the beginning and then constantly edited as time passed. Putting it in the draw meant that every time the code runs for each frame, it would reload the original mask so that the quality doesn’t diminish over time and makes sure it doesn’t get blurrier.