Change in size of object when moving.

edited November 2013 in How To...

Hi, is there a code for changing the size of an object when it is moving?

Tagged:

Answers

  • Maybe something like this?

    void setup() {
      size(800, 800);
    }
    
    void draw() {
      int rad = int(dist(mouseX, mouseY, pmouseX, pmouseY))+10;
      ellipse(mouseX, mouseY, rad, rad);
    }
    
  • edited November 2013 Answer ✓

    Or like this:

    int radius = 10;
    int posX = 10;
    
    void setup() 
    {
      size(800, 800);
    }
    
    void draw() 
    {
      background(255);
      ellipse(posX, width / 2, radius, radius);
      radius++;
      posX += 2;
    }
    

    Note: moved the topic, please, read the category descriptions!

Sign In or Register to comment.