<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Rough.js基于 Canvas 的手繪風(fēng)格圖形庫(kù)

          聯(lián)合創(chuàng)作 · 2023-09-26 02:40

          Rough.js 是一個(gè)輕量級(jí)的(大約8k),基于 Canvas 的可以繪制出粗略的手繪風(fēng)格的圖形庫(kù)。該庫(kù)提供繪制線(xiàn)條、曲線(xiàn)、弧線(xiàn)、多邊形、圓形和橢圓的基礎(chǔ)能力,同時(shí)支持繪制 SVG 路徑。


          Usage


          const rc = rough.canvas(document.getElementById('canvas'));
          rc.rectangle(10, 10, 200, 200); // x, y, width, height

          線(xiàn)條和橢圓


          rc.circle(80, 120, 50); // centerX, centerY, diameter
          rc.ellipse(300, 100, 150, 80); // centerX, centerY, width, height
          rc.line(80, 120, 300, 100); // x1, y1, x2, y2

          填充


          rc.circle(50, 50, 80, { fill: 'red' }); // fill with red hachure
          rc.rectangle(120, 15, 80, 80, { fill: 'red' });
          rc.circle(50, 150, 80, {
            fill: "rgb(10,150,10)",
            fillWeight: 3 // thicker lines for hachure
          });
          rc.rectangle(220, 15, 80, 80, {
            fill: 'red',
            hachureAngle: 60, // angle of hachure,
            hachureGap: 8
          });
          rc.rectangle(120, 105, 80, 80, {
            fill: 'rgba(255,0,200,0.2)',
            fillStyle: 'solid' // solid fill
          });

          草繪風(fēng)格


          rc.rectangle(15, 15, 80, 80, { roughness: 0.5, fill: 'red' });
          rc.rectangle(120, 15, 80, 80, { roughness: 2.8, fill: 'blue' });
          rc.rectangle(220, 15, 80, 80, { bowing: 6, stroke: 'green', strokeWidth: 3 });

          SVG 路徑


          rc.path('M80 80 A 45 45, 0, 0, 0, 125 125 L 125 80 Z', { fill: 'green' });
          rc.path('M230 80 A 45 45, 0, 1, 0, 275 125 L 275 80 Z', { fill: 'purple' });
          rc.path('M80 230 A 45 45, 0, 0, 1, 125 275 L 125 230 Z', { fill: 'red' });
          rc.path('M230 230 A 45 45, 0, 1, 1, 275 275 L 275 230 Z', { fill: 'blue' });
          瀏覽 24
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  一级二级在线观看网站 | 亚洲综合p | 天天干,天天日,天天插,人人人透 午夜久久精品嫖妓av一区二区三区 | 一级A片操逼 | 免费成年人视频 |