mirror of
https://github.com/rough-stuff/rough.git
synced 2026-01-14 17:07:58 -05:00
55 lines
1.6 KiB
HTML
55 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 roughness = 2;
|
|
|
|
const shape = rc.path('M 37.1484375 0 L 112.11328125 0 Q 149.26171875 0, 149.26171875 37.1484375 L 149.26171875 111.4453125 Q 149.26171875 148.59375, 112.11328125 148.59375 L 37.1484375 148.59375 Q 0 148.59375, 0 111.4453125 L 0 37.1484375 Q 0 0, 37.1484375 0', {
|
|
disableMultiStroke: false,
|
|
fill: undefined,
|
|
fillStyle: "hachure",
|
|
fillWeight: 0.5,
|
|
hachureGap: 4,
|
|
roughness: roughness,
|
|
seed: 2142156371,
|
|
stroke: "#000000",
|
|
strokeLineDash: undefined,
|
|
strokeWidth: 1
|
|
});
|
|
console.log(shape);
|
|
|
|
const ctx = rc.ctx;
|
|
ctx.translate(250, 0);
|
|
|
|
rc.path('M 37.1484375 0 L 112.11328125 0 Q 149.26171875 0, 149.26171875 37.1484375 L 149.26171875 111.4453125 Q 149.26171875 148.59375, 112.11328125 148.59375 L 37.1484375 148.59375 Q 0 148.59375, 0 111.4453125 L 0 37.1484375 Q 0 0, 37.1484375 0', {
|
|
disableMultiStroke: false,
|
|
fill: undefined,
|
|
fillStyle: "hachure",
|
|
fillWeight: 0.5,
|
|
hachureGap: 4,
|
|
roughness: roughness,
|
|
seed: 2142156371,
|
|
stroke: "#000000",
|
|
strokeLineDash: undefined,
|
|
strokeWidth: 1,
|
|
preserveVertices: true
|
|
});
|
|
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html> |