Skip to content

Tag: canvas

Repeating function calls

When i change a frame size, like 3×3, 4×4, 5×5 etc. canvas draw n number of times constantly calculation in progression. I can’t figure out where the error might be. Can you help me fix this bug. I suspect that the problem is in the function call in the class, or in one of the functions. …

Circles in canvas not revolving properly in proper circle

I’m making a simple program using canvas where I have a sun, and there are three planets rotating around it. I managed to make the Sun and the planets. However, when I try to revolve the planets around the Sun, for some reason the planets do not revolve in a perfect circle. Here’s my code: You can…

how to create box in HTML5?

I am trying to create two inner box . I am able to do in using HTML css . working link (expected output) https://stackblitz.com/edit/js-lvzg4o?file=index.js When I trying to do the same thing using Canvas. I am not able create two box or container where I will put my text. is it possible to do same thing usin…

Get coordinates of the points in an ellipse in HTML5 Canvas

In HTML5 Canvas, I know I can draw an ellipse with CanvasRenderingContext2D.ellipse(), but how can I draw some points on the ellipse path? I can draw points on a circular path using the following codes: p.s. ignore the colors and the dot at the center. But how to do this with an ellipse? I don’t want to…