123456789101112131415161718 |
- var c = document.getElementById("myCanvas");
- var ctx = c.getContext("2d");
- let selection = [];
- color.onchange = () => {
- selection.forEach((c) => (c.color = color.value));
- };
- c.onmousemove = ({ clientX, clientY, buttons }) => {
- if (buttons > 0) {
- ctx.fillStyle = color.value;
- ctx.beginPath();
- ctx.arc(clientX, clientY, size.value, 0, Math.PI * 2);
- ctx.closePath();
- ctx.fill();
- }
- };
|