Files
rough/visual-tests/canvas/rectangle.html
Preet 24fd61d3be Updated Nested hachure fill (#195)
* complex path fills

* .

* updated zigzag fill

* removed unused code
2021-11-07 22:07:26 -08:00

48 lines
1.6 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);
// const ctx = canvas.getContext('2d');
// ctx.scale(20, 20);
// rc.rectangle(5, 5, 5, 5, {
// fill: 'red', roughness: 0.1,
// strokeWidth: 0.1,
// fillWeight: 0.05,
// hachureGap: 0.5,
// fillStyle: 'dots',
// curveFitting: 1,
// curveTightness: 0.7
// });
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: 0 });
rc.rectangle(110, 110, 80, 80, { fill: 'red', stroke: 'blue', hachureAngle: 0, strokeWidth: 3 });
rc.rectangle(210, 110, 80, 80, { fill: 'pink', fillWeight: 5, hachureGap: 10, hachureAngle: 90 });
rc.rectangle(10, 210, 480, 280, { fill: 'red', fillStyle: 'dots', hachureGap: 20, fillWeight: 2 });
rc.rectangle(10, 210, 480, 280, { fill: 'orange', fillStyle: 'zigzag', hachureGap: 20, fillWeight: 2 });
</script>
</body>
</html>