curves through points

This commit is contained in:
Preet Shihn
2018-03-05 13:58:19 -08:00
parent 6d8ff0ef29
commit 498ebfa180
4 changed files with 89 additions and 4 deletions

View File

@@ -66,6 +66,19 @@
stroke: 'blue', strokeWidth: 2,
fill: 'rgba(255,0,255,0.4)'
});
// draw sine curve
let points = [];
for (let i = 0; i < 20; i++) {
// 4pi - 400px
let x = (400 / 20) * i + 10;
let xdeg = (Math.PI / 100) * x;
let y = Math.round(Math.sin(xdeg) * 90) + 500;
points.push([x, y]);
}
await rough.curve(points, {
roughness: 1.2, stroke: 'red', strokeWidth: 3
});
})();
</script>
</body>