What is the initial value of X in this code from the book?

Hi, I'm new to processing and I have a small question about Example 5-8 : Easing Does It in the second eddition of the getting started with processing book.

Here is the code:

    float x;
    float easing = 1;

    void setup(){
    size(544,416);
    }

    void draw(){
      float targetX = mouseX;           
      x += (targetX - x)*easing;          
      ellipse(x, 40, 12, 12);            
      println(targetX + " : " + x); 
    }

My question is about the value of x. From my understanding, the value of (targetX - x)*easing is added onto the variable x, but in that formula, x is being taken away. What exactly is the initial value of x, how is this being calculated?

Tagged:

Answers

Sign In or Register to comment.