Files
rough/visual-tests/canvas/curve.html
Preet Shihn 7f15d09592 .
2020-04-12 23:39:35 -07:00

80 lines
1.7 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);
rc.curve([
[10, 10],
[200, 10],
[100, 100],
[100, 50],
[300, 100],
[60, 200]
], { stroke: 'black', strokeWidth: 2, fill: 'red', hachureAngle: 90 });
canvas.getContext('2d').translate(0, 210);
rc.curve([
[10, 10],
[200, 10],
[100, 100],
[100, 50],
[300, 100],
[60, 200]
], { fill: 'red', fillStyle: 'solid' });
canvas.getContext('2d').translate(0, 210);
rc.curve([
[10, 10],
[200, 10],
[100, 100],
[100, 50],
[300, 100],
[60, 200]
], { fill: 'red', fillStyle: 'dots', hachureGap: 16, fillWeight: 2 });
canvas.getContext('2d').translate(300, 0);
rc.curve([
[10, 10],
[200, 10],
[100, 100],
[100, 50],
[300, 100],
[60, 200]
], { fill: 'red', fillStyle: 'cross-hatch', hachureGap: 8 });
canvas.getContext('2d').translate(0, -210);
rc.curve([
[10, 10],
[200, 10],
[100, 100],
[100, 50],
[300, 100],
[60, 200]
], { fill: 'red', fillStyle: 'zigzag', hachureGap: 8 });
canvas.getContext('2d').translate(0, -210);
rc.curve([
[10, 10],
[200, 10],
[100, 100],
[100, 50],
[300, 100],
[60, 200]
], { stroke: 'orange', strokeWidth: 5 });
</script>
</body>
</html>