Files
rough/visual-tests/canvas/rectangle.html
2020-04-12 21:07:11 -07:00

34 lines
1.2 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);
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 });
rc.rectangle(210, 110, 80, 80, { fill: 'pink', fillWeight: 5, hachureGap: 10, hachureAngle: 90 });
rc.rectangle(10, 210, 480, 280, { fill: 'pink', fillStyle: 'dots', hachureGap: 10 });
</script>
</body>
</html>