JavaScript 的 SVG 庫:Paths.js

jopen 11年前發布 | 19K 次閱讀 Paths.js JavaScript開發

Paths.js 是一個可以幫你生成 SVG paths 的工具。可通過使用類似 Mustache or Handlebars 的模板引擎來在瀏覽器上顯示 SVG 圖形。

Path()
  .moveto(2, 10)
  .lineto(3, 5)
  .hlineto(4)
  .vlineto(3)
  .curveto(1, 1, 2, 5, 3, 1)
  .smoothcurveto(2, 5, 2, 6)
  .qcurveto(0, 1, 2, 3)
  .smoothqcurveto(6, -3)
  .arc(3, 3, 2, 0, 1, 6, -3)
  .closepath()

is equivalent to:

Path() .moveto({x: 2, y: 10}) .lineto({x: 3, y: 5}) .hlineto({x: 4}) .vlineto({y: 3}) .curveto({x1: 1, y1: 1, x2: 2, y2: 5, x: 3, y:1}) .smoothcurveto({x2: 2, y2: 5, x: 2, y: 6}) .qcurveto({x1: 0, y1: 1, x: 2, y: 3}) .smoothqcurveto({x: 6, y: -3}) .arc({rx: 3, ry: 3, xrot: 2, large_arc_flag: 0, sweep_flag: 1, x: 6, y: -3}) .closepath()</pre>

項目主頁:http://www.baiduhome.net/lib/view/home/1411203874265

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!