+ 1

HTML5 CANVAS

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

16th Mar 2019, 12:03 PM
Lucy
Lucy - avatar
6 odpowiedzi
+ 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 https://code.sololearn.com/W8806jRe6N7p/?ref=app
16th Mar 2019, 2:04 PM
Calviղ
Calviղ - avatar
+ 1
Its Kontol
20th Sep 2019, 11:22 PM
Fikri Abdillah
Fikri Abdillah - avatar
0
you just need to do this in peace no wahala
20th Oct 2020, 11:39 AM
Atsu Klenam Dzogbetsi
Atsu Klenam Dzogbetsi - avatar
0
This.rad+= this.speed
14th Feb 2021, 1:54 AM
Marin Way
Marin Way - avatar