random.js 356 B

123456789101112131415
  1. var stage = new mtm.Stage('c'),
  2. ball = new Ball(),
  3. angleX = 0, angleY = 0,
  4. centerX = 200, centerY = 200,
  5. speedX = .07, speedY = .11,
  6. range = 50;
  7. stage.shapes.push(ball);
  8. stage.play(function() {
  9. ball.x = centerX + Math.sin(angleX) * range;
  10. ball.y = centerY + Math.sin(angleY) * range;
  11. angleX += speedX;
  12. angleY += speedY;
  13. });