Copy link to clipboard
Copied
Hello,
In Animate HTML5 canvas, I draw a graphic with the mouse (var ctx = canvas.getContext("2d") ;...) and I wish that the drawing can not be done outside a frame whose dimensions and coordinates are defined. Is it possible to specify the coordinates and size of this frame? I can't find an answer.
Thank you for any help.
Copy link to clipboard
Copied
I don't understand what the problem is. Your code is already retrieving the mouse coordinates and using them to plot pixels on a canvas element, so... just check the coordinate values?
Copy link to clipboard
Copied
It's perfect, thank you very much. I hadn't thought about it. I have one last question please: is it possible to scroll indefinitely the created design to the left or to the right?
Thank you for your answer.