Files
rough/visual-tests/canvas/dashed/rectangle.html
Preet fd621f41c3 Dashed line support (#159)
* stroke line dash for canvas

* canvas fill dashes

* dashed line support in SVG
2020-05-11 00:29:33 -07:00

39 lines
1.4 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<title>RoughJS Rectangle</title>
</head>
<body>
<canvas width="800" height="800"></canvas>
<script type="module">
import rough from '../../../bin/rough.js';
const canvas = document.querySelector('canvas');
const rc = rough.canvas(canvas, {
options: {
strokeLineDash: [15, 5],
strokeLineDashOffset: 10
}
});
rc.rectangle(10, 10, 80, 80);
rc.rectangle(110, 10, 80, 80, { fill: 'red' });
rc.rectangle(210, 10, 80, 80, { fill: 'pink', fillStyle: 'solid' });
rc.rectangle(310, 10, 80, 80, { fill: 'red', fillStyle: 'cross-hatch' });
rc.rectangle(410, 10, 80, 80, { fill: 'red', fillStyle: 'zigzag', hachureGap: 8 });
rc.rectangle(510, 10, 80, 80, { fill: 'red', fillStyle: 'dots' });
rc.rectangle(10, 110, 80, 80, { roughness: 2 });
rc.rectangle(110, 110, 80, 80, { fill: 'red', stroke: 'blue', hachureAngle: 0, strokeWidth: 3, fillLineDash: [15, 5], fillLineDashOffset: 10 });
rc.rectangle(210, 110, 80, 80, { fill: 'pink', fillWeight: 5, hachureGap: 10, hachureAngle: 90, fillLineDash: [15, 5], fillLineDashOffset: 10 });
rc.rectangle(10, 210, 480, 280, { fill: 'red', fillStyle: 'dots', hachureGap: 20, fillWeight: 2 });
</script>
</body>
</html>