Wednesday, October 12, 2011

HTML5 canvas animations

Intentions:
  • Get some simple animations down

Summary:
Got a player running in a direction, then another player kicks to button click. The intention would be to kick the ball with the right timing to hit the lead. Plenty of ideas for where to go next.

Interesting Findings:
  • setInterval(draw, 40) will call draw function every 40 milliseconds where you can do a "refresh" of your animations
  • use addEventListener to add a click event to the canvas
  • in draw, keep one player running the lead by incrementing x and y, keep the ball going towards where clicked, if clicked yet.
Overall I was impressed how easy it was to do some simple animations. Looking forward to getting a list of requests ready and working through them.

No comments:

Post a Comment