How can I make circles formed with movement of mouse move in an upward direction as they disappear?

edited October 2017 in How To...

How can I rewrite the following code to make the circles that fade out move in an upward direction as they fade out? I would like to make the circles look like particles of vapor or water bubbles that rise upwards as they disappear.

int num = 60;
float mx[] = new float[num];
float my[] = new float[num];

void setup() {
  size(640, 360);
  noStroke();
  fill(255, 153); 
}

void draw() {
  background(51); 

  // Cycle through the array, using a different entry on each frame. 
  // Using modulo (%) like this is faster than moving all the values over.
  int which = frameCount % num;
  mx[which] = mouseX;
  my[which] = mouseY;

  for (int i = 0; i < num; i++) {
    // which+1 is the smallest (the oldest in the array)
    int index = (which+1 + i) % num;
    ellipse(mx[index], my[index], i, i);
  }
}

Thank you in advance! :)

Tagged:

Answers

  • please don't post duplicates or split discussions into multiple threads, it confuses people.

    what's up with this: https://forum.processing.org/two/discussion/24548/how-to-make-balls-move-from-bottom-to-top-with-fluid-resistance-effect

  • edited October 2017

    The previous thread was to create the effect of circles moving up from a set point to the top with a single click. For this one, I would like to know how to create multiple circles that are formed by moving the cursor (like in the code mentioned above) and was curious if there was a way to make these circles move upward as they fade out. Hope this makes sense... I apologize for any confusion.

  • The previous thread was to create the effect of circles moving up

    For this one, I would like to know how to create multiple circles... make these circles move upward

  • edited October 2017

    I see what you mean and I guess the two threads are similar but not identical regarding my question. In this thread, by multiple circles I am referring to circles that appear as we move the mouse and I do not mean circles that are already fixed in position. Is there any way to make these circles that become transparent move upwards using the answer I received from the previous thread? I am new to processing and would greatly appreciate anyone's help.

Sign In or Register to comment.