Stand alone animation
in
Programming Questions
•
1 year ago
I'm trying to make an animation that is activated by a mouse click and then repeats after you move the mouse away. I figure it has something to do with the circle having mouseX and mouseY coordinates. So my question is; How do i dictate the animation starts at mouseX and mouseY without restricting the animations playtime to when the mouse stays in those positions? Also is there a way to make the circles refresh (disappear and reappear) instead of piling on top of one another. Here is the code so far
- float w = 0.0;
- float c= 0;
- boolean obj=false;
- void setup() {
- smooth();
- size(300,300);
- }
- void draw() {
- frameRate(60);
- if (obj == true){
- ellipse(mouseX, mouseY, w, w);
- fill(c, c, c, 255 + c);
- if (w > 65) {
- w = 0;
- }
- }
- w = w + 1;
- c = w + 8;
- }
- void mousePressed(){
- obj = true;
- }
- void mouseMoved() {
- obj = false;
- }
- void mouseDragged() {
- obj = false;
- }
1