个人原创,欢迎转载,转载请注明出处http://blog.youkuaiyun.com/bud_icelf QQ:909648986
EaselJS 绘制图形1
本节将介绍使用Shape对象,绘制矩形,绘制圆形,画线,绘制贝塞尔曲线,绘制带圆角的矩形.
例子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();
var graphics=shape.graphics;
graphics.beginFill("red");
graphics.drawRect(0,0,100,100);
stage.addChild(shape);
stage.update();
</script>
</body>
</html>
效果预览
var shape=new createjs.Shape();
创建Shpae对象.
var graphics=shape.graphics;
通过Shape对象获取graphics对象.
<
创建Shpae对象.
var graphics=shape.graphics;
通过Shape对象获取graphics对象.
<