     spherePosition += dxSphere;

      if (spherePosition >= 30 || spherePosition <= -30) {
        dxSphere = -dxSphere;
      }

      conePosition += dx_cone;
      if (conePosition >= 35 || conePosition <= -35) {
        dx_cone = -dx_cone;
      }

      draw();
    }

    function onFrame() {
      elapsedTime = (new Date).getTime() - initialTime;
      if (elapsedTime < animationRate) return;

      let steps = Math.floor(elapsedTime / simulationRate);
      while (steps > 0) {
        animate();
  