oval.js 325 B

1234567891011121314
  1. var stage = new mtm.Stage('c'),
  2. ball = new Ball(),
  3. centerX = 200, centerY = 200,
  4. radiusX = 160, radiusY = 80,
  5. angle = 0,
  6. speed = .1;
  7. stage.shapes.push(ball);
  8. stage.play(function() {
  9. ball.x = centerX + Math.sin(angle) * radiusX;
  10. ball.y = centerY + Math.cos(angle) * radiusY;
  11. angle += speed;
  12. });