title: Moving along Bezier Curve in processing
body: <p>My code for <code>the ball moving in a Bezier Curve from start to the middle of the curve</code> is:</p>
  
  <pre><code>     void ballMove()
      {
  
        if(y[0]==height*1/10)
        {
  
          bezier (x[0], y[0],x[1], y[1], x[2], y[2], x[3], y[3]);
        float x0; float x1; float x2; float x3; 
      float y0; float y1; float y2; float y3;
  
      x0 = x[0]; x1 = x[1]; x2 = x[2]; x3 = x[3]; 
      y0 = y[0]; y1 = y[1]; y2 = y[2]; y3 = y[3];
  
  
       float t =  (frameCount/100.0)%1;
        float x = bezierPoint(x0, x1, x2, x3, t);
        float y = bezierPoint( y0, y1, y2, y3, t);
  
         if(t&gt;=0.5)
        {
          t=0;
        }
  
        while(t==0.5)
       {
         a=x;
         b=y;
       }
        while(t&gt;0.5)
        {
          ellipse(a,b,30,30);
        }
        fill(255,0,0);
        if(t!=0)
        {
        ellipse(x, y, 15, 15);
        }
        }
      }
  </code></pre>
  
  <p>I have defined everything in setup, draw etc, but i want to launch the ball from the start to the middle of the Bezier Curve only one time whenever space is pressed. </p>
  
  <p>The current version shows me the loop. How can i do that? </p>
  
  <p>Tried Everything like return, break, changing the t parameter etc, but the code doesn't work. I'm new in processing. </p>
  
  <p>Do you have any suggestions?</p>