Files
rough/examples/2.0/test2.html
2018-03-10 19:48:19 -08:00

47 lines
1.3 KiB
HTML

<html>
<head>
<title>RoughJS sample</title>
<script src="https://cdn.jsdelivr.net/gh/pshihn/workly/dist/workly.js"></script>
<script src="../../dist/rough.min.js"></script>
<style>
canvas {
border: 1px solid #000;
}
path {
stroke: #000;
fill: none;
}
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
(async () => {
const rough = new RoughCanvas(document.getElementById('canvas'));
await rough.path('M400 100 h 90 v 90 h -90z', {
stroke: 'red',
strokeWidth: '2',
fill: 'rgba(0,0,255,0.2)',
fillStyle: 'solid'
});
await rough.path('M400 250 h 90 v 90 h -90z', {
fill: 'rgba(0,0,255,0.6)'
});
await rough.path('M37,17v15H14V17z M50,0H0v50h50z', {
stroke: 'red',
strokeWidth: '1',
fill: 'blue'
});
await rough.path('M80 80 A 45 45, 0, 0, 0, 125 125 L 125 80 Z', { fill: 'green' });
await rough.path('M230 80 A 45 45, 0, 1, 0, 275 125 L 275 80 Z', { fill: 'purple', hachureAngle: 60, hachureGap: 5 });
await rough.path('M80 230 A 45 45, 0, 0, 1, 125 275 L 125 230 Z', { fill: 'red' });
await rough.path('M230 230 A 45 45, 0, 1, 1, 275 275 L 275 230 Z', { fill: 'blue' });
})();
</script>
</body>
</html>