HTML5 CANVAS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1


Does anyone know how to trace an arc/circle in the canvas with other arcs/circles ?

16th Mar 2019, 12:03 PM
Lucy - avatar
6 Answers
+ 7
A simple arc can be drawn using arc method. ctx.beginPath() ctx.arc(x,y,radius,startAngle,endAngle) ctx.closePath() What did you actually mean by "with other arcs"?
16th Mar 2019, 1:45 PM
Шащи Ранжан
Шащи Ранжан - avatar
+ 3
To make an object move in circular motion, you need to keep on update the x, y position using cos function for x change and sin function for y change. Eg. In the update function // move in circular this.rad += this.speed this.x += Math.cos(this.rad) * circularSize this.y += Math.sin(this.rad) * circularSize Check out thus code
16th Mar 2019, 2:04 PM
Calviղ - avatar
+ 1
Its Kontol
20th Sep 2019, 11:22 PM
Fikri Abdillah
Fikri Abdillah - avatar
you just need to do this in peace no wahala
20th Oct 2020, 11:39 AM
Atsu Klenam Dzogbetsi
Atsu Klenam Dzogbetsi - avatar
This.rad+= this.speed
14th Feb 2021, 1:54 AM
Marin Way
Marin Way - avatar