M
M
marsel812018-07-19 23:30:25
JavaScript
marsel81, 2018-07-19 23:30:25

How to set rotation (rotate) in a circle?

I have an earth object:

var time = new Date();
       // ctx.rotate( ((2*Math.PI)/60)*time.getSeconds() + ((2*Math.PI)/60000)*time.getMilliseconds() );
        ctx.translate(105,0);
        //ctx.fillRect(0,-12,50,24); // Shadow
        ctx.drawImage(earth,-500,-400);

There is an orbit object:
ctx.beginPath();
          ctx.arc(600,600,100,0,Math.PI*2,false); 
        ctx.stroke();

How to make the earth rotate in this orbit?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Bhudh, 2018-08-11
@Bhudh

Sine, cosine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question