mirror of
https://github.com/rough-stuff/rough.git
synced 2026-04-22 03:00:28 -04:00
74 lines
1.6 KiB
HTML
74 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 Curve</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');
|
|
|
|
rc.curve([
|
|
[10, 10],
|
|
[200, 10],
|
|
[100, 100],
|
|
[100, 50],
|
|
[300, 100],
|
|
[60, 200]
|
|
], { stroke: 'black', strokeWidth: 2, fill: 'red', hachureGap: 10 });
|
|
|
|
ctx.translate(0, 210);
|
|
rc.curve([
|
|
[10, 10],
|
|
[200, 10],
|
|
[100, 100],
|
|
[100, 50],
|
|
[300, 100],
|
|
[60, 200]
|
|
], { fill: 'red', fillStyle: 'solid', roughness: 3 });
|
|
|
|
ctx.translate(0, 210);
|
|
rc.curve([
|
|
[10, 10],
|
|
[200, 10],
|
|
[100, 100],
|
|
[100, 50],
|
|
[300, 100],
|
|
[60, 200]
|
|
], { fill: 'red', fillStyle: 'cross-hatch', hachureGap: 8 });
|
|
|
|
ctx.translate(300, 0);
|
|
|
|
|
|
ctx.translate(0, -210);
|
|
rc.curve([
|
|
[10, 10],
|
|
[200, 10],
|
|
[100, 100],
|
|
[100, 50],
|
|
[300, 100],
|
|
[60, 200]
|
|
], { fill: 'red', fillStyle: 'solid', stroke: 'none', roughness: 3 });
|
|
|
|
ctx.translate(0, -210);
|
|
rc.curve([
|
|
[10, 10],
|
|
[200, 10],
|
|
[100, 100],
|
|
[100, 50],
|
|
[300, 100],
|
|
[60, 200]
|
|
], { stroke: 'black', strokeWidth: 2, fill: 'red', hachureGap: 10, stroke: 'none' });
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html> |