erasecode
in
Programming Questions
•
1 year ago
Hi everybody! I'm trying to modify a code calls "erasecode", it is exactly what I need except one thing. In this code the constrain effect is a square, I would like to have a circle...any advice?
this is the code I am using:
this is the code I am using:
int SQUARE_WIDTH = 20;
int SQUARE_HEIGHT = 20;
PImage img1,img2;
void setup() {
size(864,499);
img1 = loadImage("bw.jpg");
img2 = loadImage("animalcreation.jpg");
image(img1,0,0);
}
void draw() {
if(mousePressed)
copy(img2,
constrain(mouseX-SQUARE_WIDTH/2,0,width),
constrain(mouseY-SQUARE_HEIGHT/2,0,height),
SQUARE_WIDTH,SQUARE_HEIGHT,
constrain(mouseX-SQUARE_WIDTH/2,0,width),
constrain(mouseY-SQUARE_HEIGHT/2,0,height),
SQUARE_WIDTH,SQUARE_HEIGHT);
}
thanks a lot!
1