mirror of
https://github.com/rough-stuff/rough.git
synced 2026-01-15 01:18:26 -05:00
46 lines
1.3 KiB
HTML
46 lines
1.3 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 Arc</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.arc(350, 200, 200, 180, Math.PI, Math.PI * 1.6);
|
|
rc.arc(350, 300, 200, 180, Math.PI, Math.PI * 1.6, true);
|
|
rc.arc(350, 300, 200, 180, 0, Math.PI / 2, true, {
|
|
stroke: 'red', strokeWidth: 4,
|
|
fill: 'rgba(255,255,0,0.4)', fillStyle: 'solid'
|
|
});
|
|
rc.arc(350, 300, 200, 180, Math.PI / 2, Math.PI, true, {
|
|
stroke: 'blue', strokeWidth: 2,
|
|
fill: 'rgba(255,0,255,0.4)'
|
|
});
|
|
|
|
canvas.getContext('2d').translate(-210, 0);
|
|
rc.arc(350, 300, 200, 180, Math.PI, Math.PI * 1.6, true, {
|
|
fill: 'red', fillStyle: 'zigzag',
|
|
hachureGap: 10
|
|
});
|
|
rc.arc(350, 300, 200, 180, 0, Math.PI / 2, true, {
|
|
stroke: 'red', strokeWidth: 4,
|
|
fill: 'orange', fillStyle: 'dots'
|
|
});
|
|
rc.arc(350, 300, 200, 180, Math.PI / 2, Math.PI, true, {
|
|
stroke: 'blue', strokeWidth: 2,
|
|
fill: 'red', fillStyle: 'cross-hatch'
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html> |