title: How do I change the speed of an AnimationTimer in JavaFX?
body: <p>I'm trying to change the speed of an <code>AnimationTimer</code> so the code runs slower, here is the code I have so far:</p>
  
  <pre class="lang-java prettyprint-override"><code>AnimationTimer timer = new AnimationTimer() {
  
      @Override
      public void handle(long now) {    
          if (upOrDown != 1) {
              for (int i = 0; i &lt; 4; i++) {
                  snakePositionDown[i] = snake[i].getX();
                  snakePositionDownY[i] = snake[i].getY();
              }
  
              snake[0].setY(snake[0].getY() + 25);
  
              for (int i = 1; i &lt; 4; i++) {
                  snake[i].setX(snakePositionDown[i - 1]);
                  snake[i].setY(snakePositionDownY[i - 1]);
              }
  
              leftOrRight = 2;
              upOrDown = 0;
          }
      }
  
  };
  
  timer.start();
  </code></pre>
  
  <p>How would I make the <code>AnimationTimer</code> run slower?</p>
  
  <p>Thanks in advance!</p>