1

Is there any easy way to draw a path, by passing a string value representing that path.

For example, in fabric.js you can do something like that:

var path = new fabric.Path('M 0 0 L 200 100 L 170 200 z');

Is there anything similar to that in easeljs. I looked at the documentation, i couldn't find anything.

4

1 回答 1

2

Graphics 上有一个很小的 ​​API,非常易于使用:

graphics.f("#ff0000").mt(100,100).lt(100,100).ss(1).s("#0000ff").dc(100,0,50);

http://www.createjs.com/Docs/EaselJS/classes/Graphics.html

对于基于字符串的东西,还有一个“decodePath”API http://www.createjs.com/Docs/EaselJS/classes/Graphics.html#method_decodePath

它并不冗长,因为它用于工具输出。Flash Pro 中的 DrawScript 和 Toolkit for CreateJS 都支持它。

于 2013-04-20T01:07:11.493 回答