Change position of shapes drawn in sketch, without affecting future shapes drawn on mousePressed
in
Programming Questions
•
2 years ago
Hey! I am trying to create a sketch where the user draws circles, and, after a set amount of time, the previously drawn circles' y position changes.
I tried a variable that subtracted .01 each loop, but that lowered the position of all future circles as well. Is there any way to only specify the position of circles already drawn?
Thanks for reading and for any advice!
- boolean brushOn = false;
- float moveY = 0;
- void setup() {
- size(500, 300);
- background(#FFFFFF);
- } //end setup
- void draw() {
- moveY = moveY + .01;
- if(brushOn == true){
- fill(#000000, 70);
- ellipse(pmouseX, pmouseY + moveY, 40, 40);
- }
- } //end draw
- void mousePressed(){
- brushOn = true; //start drawing when pressed
- }
- void mouseReleased(){
- brushOn = false; //stop drawing when released
- }
1