Is it possible to restrict an object's motion by using a pixel value as a boarder? In other words, if I have a white shape on a black background, can I tell processing something like
if ("pixel value is black") {
velocity.x = -1*velocity.x;
velocity.y = -1*velocity.y;
}
The image below is what I would like to use. I have elements in motion using the following code, but I want to restrict the motion to occur within the swiggly shape (see image).