wave1.js 276 B

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