-
Notifications
You must be signed in to change notification settings - Fork 0
Graphics
何波 edited this page Feb 27, 2019
·
30 revisions
Graphics类公开了一个易于使用的API,用于生成矢量绘图指令并将它们绘制到指定的上下文。请注意,您可以通过调用graphics/draw来使用图形,而不依赖于easeljs框架。或者直接与Shape对象一起使用,在EaselJS显示列表的上下文上绘制矢量图形。
使用Graphics类有两种方法
- 先实例化Graphics类,再调用实例中的方法
-
new Graphics().command,用Graphics/append将其添加到graphics队列中。
前者抽象后者,简化开始和结束路径、填充和笔画。
var g = new createjs.Graphics();
g.setStrokeStyle(1);
g.beginStroke("#000000");
g.beginFill("red");
g.drawCircle(0,0,30);