We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I have a very beginner question- I use processing mostly to create visual collages, nothing too complicated. Currently, I'm working with a code to generate images selected at random to the canvas. What I would like to do, is have the images only load within the invisible boundaries of an ellipse. Say my canvas is 500px by 500px- well I would like to draw images only within the boundaries of an ellipse that has the coordinates (250, 250) and a radius of 100px. Thanks for any help.
Answers
the pixelwise version I have come up with uses the pixel array
draw a pgraphics object with a white background and black circle and call it mask
Or just use the builtin function mask()
@adrock42, I think you forgot to declare img. And a closing parenthesis at line 20 : )
indeed, its hard coding on a phone. I have been ignoring mask until they include it in processing.js
Thanks for both of your help!! I don't want to use a mask though, if possible. I am trying to use the ellipse just as a barrier that images don't get drawn past so that the images that start populating the screen seem to be contained, but contained organically. Is there any way to define the barrier using the coordinates? Here is the code I am presently working with:
I mean the mask works for sure, but the rim of the circle will cut off the images.