Javascript examples for Canvas:Animation
Create animation using createjs
<html> <head> <title>Simple Tween example</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://rawgit.com/CreateJS/Combined/master/builds/1.0.0/createjs.min.js"></script> <style id="compiled-css" type="text/css"> body, html { margin: 0; padding: 0; } canvas {/*w ww . j a v a 2 s .c o m*/ } </style> <script type="text/javascript"> window.onload=function(){ var stage, bmp; function init() { stage = new createjs.Stage("canvas"); createjs.Ticker.on("tick", stage); bmp = new createjs.Bitmap("https://www.java2s.com/style/demo/Google-Chrome.png"); bmp.set({ x: 50, y: 50, alpha: 1}); stage.addChild(bmp); createjs.Tween.get(bmp, {loop:-1, bounce:true}).to({ alpha: 0, x:500, y:400 }, 1000); } init(); } </script> </head> <body> <canvas id="canvas" width="800" height="600"></canvas> </body> </html>