0
How can we make a dynamic drawing an element on canvas? Please help!!
2 odpowiedzi
0
@Jonathan thank you for your response.. I am making triangle in canvas by dragging the mouse .the size of triangle is depending on how much i drag the mouse.. and now what i want to make those triangle element on the html page so i can add event listeners to them and drag them to one place to another place. i have to use only pure javascript no external libraries or frameworks
- 1
I'm not sure if this is what you mean...
to be able to draw dynamically in canvas, you would need animation methods like using setInterval or the requestAnimationFrame.
You will need to draw everything over and over again to achieve the result you want....
Here's an example code:
https://code.sololearn.com/W5VAi1syt4k8/?ref=app
This code only draws small circles but changes the coordinates in small amounts in every draw to achieve the effect of drawing.