mirror of
https://github.com/rough-stuff/rough.git
synced 2026-01-15 01:18:26 -05:00
39 lines
1.5 KiB
HTML
39 lines
1.5 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>
|
|
<svg width="800" height="800"></svg>
|
|
|
|
<script type="module">
|
|
import rough from '../../../bin/rough.js';
|
|
const svg = document.querySelector('svg');
|
|
const rc = rough.svg(svg, {
|
|
options: {
|
|
strokeLineDash: [15, 5],
|
|
strokeLineDashOffset: 10
|
|
}
|
|
});
|
|
|
|
svg.appendChild(rc.rectangle(10, 10, 80, 80));
|
|
svg.appendChild(rc.rectangle(110, 10, 80, 80, { fill: 'red' }));
|
|
svg.appendChild(rc.rectangle(210, 10, 80, 80, { fill: 'pink', fillStyle: 'solid' }));
|
|
svg.appendChild(rc.rectangle(310, 10, 80, 80, { fill: 'red', fillStyle: 'cross-hatch' }));
|
|
svg.appendChild(rc.rectangle(410, 10, 80, 80, { fill: 'red', fillStyle: 'zigzag', hachureGap: 8 }));
|
|
svg.appendChild(rc.rectangle(510, 10, 80, 80, { fill: 'red', fillStyle: 'dots' }));
|
|
|
|
svg.appendChild(rc.rectangle(10, 110, 80, 80, { roughness: 2 }));
|
|
svg.appendChild(rc.rectangle(110, 110, 80, 80, { fill: 'red', stroke: 'blue', hachureAngle: 0, strokeWidth: 3, fillLineDash: [15, 5], fillLineDashOffset: 10 }));
|
|
svg.appendChild(rc.rectangle(210, 110, 80, 80, { fill: 'pink', fillWeight: 5, hachureGap: 10, hachureAngle: 90, fillLineDash: [15, 5], fillLineDashOffset: 10 }));
|
|
|
|
svg.appendChild(rc.rectangle(10, 210, 480, 280, { fill: 'red', fillStyle: 'dots', hachureGap: 20, fillWeight: 2 }));
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html> |