+ 1
HTML5 CANVAS
Does anyone know how to trace an arc/circle in the canvas with other arcs/circles ?
6 Respuestas
+ 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"?
+ 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
+ 1
Its Kontol
0
you just need to do this in peace no wahala
0
This.rad+= this.speed