animate(s)


  
  /*
   * The main animate method. Calls itself repeatedly.
   */
  function animate() {
   var delay = 10;
   
   // animates the modulator to spin the heart
   myMouseModulator.animate();
   
   // animates the modulator to beat the heart
   myHeartBeatModulator.animate();
  
   
   // animates HeartModel ----------------------------------------
  
   // transforms the heart depending on mouse movements
   //  and on heart beat function
   var myMatrix = myMouseModulator.getMatrix();
   myMatrix.compose(myHeartBeatModulator.getMatrix());
   heartModel.transform(myMatrix);
  
   // updates display
   heartModel.draw();
   
   
   // animates HeartShadowModel ----------------------------------------
   
   // copies the current positions of the points from the heart model
   heartShadowModel.copyPointsFrom(heartModel);
   // transforms the heart as it is its own shadow
   heartShadowModel.transform(reflectionMatrix);
  
   // updates display
   heartShadowModel.draw();
  
   
   // calls itself with an delay to decouple client computer speed from the animation speed.
   // result: the animation is as fast as possible.
   setTimeout("animate()", delay);
  }