个人原创,欢迎转载,转载请注明出处http://blog.csdn.net/bud_icelf QQ:909648986
EaselJS 动画
本节将介绍创建图形动画,精灵表位图动画,DOM元素动画.
例子1 图形动画
<!DOCTYPE html>
<html>
<head>
<meta charset="gbk">
<script type="text/javascript" src="easeljs-0.6.0.min.js"></script>
</head>
<body>
<canvas id="myCanvas" width="200" height="200">
你的浏览器不支持canvas标签
</canvas>
<script>
var myCanvas=document.getElementById("myCanvas");
var stage=new createjs.Stage(myCanvas);
var shape=new createjs.Shape();
shape.graphics.beginFill("red").drawRect(0,0,50,50);
createjs.Ticker.addEventListener("tick",tick);
function tick(event){
if(shape.x>stage.canvas.width){
shape.x=0;
}
shape.x++;
stage.update();
}
stage.addChild(shape);
stage.update();
</script>
</body>
</html>
效果显示<