HTML5 CANVAS | Sololearn: Learn to code for FREE!



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

3/16/2019 12:03:34 PM


6 Answers

New Answer


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"?

+5 // it may help you😉


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


Its Kontol


you just need to do this in peace no wahala


This.rad+= this.speed