title: Rotate one Image on Center of another Image using javascript or jQuery
body: <p><img src="https://i.stack.imgur.com/xtMvc.jpg" alt="Earth Rotation"></p>
  
  <p>Hello I am lilbit new to Javascript and Jquery.
  i want to move earth(image) around sun(image) but i dont want to use any jQuery-plugin.
  I have tried few Option but it is not working.
  So If there is anyway(i guess it is) then plz answer.
  Thanks in Advance</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;style type="text/css"&gt;
  body {
  background-color: ivory;
  }
  
  canvas {
  position:absolute;
  left:15%;
  top:5%;
  margin-left:center;
  margin-top:center;
  background-color:black;
  border:1px solid red;
  }
  
  #Aditya{
  position:relative;
  top:25%;
  left:20%;
  
  }
  &lt;/style&gt;
  &lt;script type="text/javascript" src="js/Jquery.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      $(document).ready(function(){
  
      var canvas = document.getElementById("icanvas");
      var ctx = canvas.getContext("2d");
  
      var radianAngle = 0;
      var cx = 400;
      var cy = 400;
      var radius = 230;
  
      var img = document.getElementById("myearth");
      img.height="5px";
      img.width="5px";
      img.onload = start;
  
      function start() {
          animate();
      }
  
      function animate() {
          requestAnimationFrame(animate);
  
          // Drawing code goes here
          radianAngle +=Math.PI / 120;
          ctx.clearRect(0, 0, canvas.width, canvas.height);
  
          // draw the image rotated around the circumference
          ctx.save();
          ctx.translate(cx, cy);
          ctx.rotate(radianAngle);
          ctx.drawImage(img, radius - img.width / 2, -img.height/2);
          ctx.restore();
      }
  }); 
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;canvas id="icanvas" width="800px" height="800px"&gt;
  &lt;img src="earth.jpg" alt="earth" id="myearth" width="50%" height="50%"&gt;&lt;/img&gt;
  &lt;img src="sun.jpg" alt="Sun" id="Aditya"&gt;&lt;/img&gt;
  &lt;/canvas&gt;
  &lt;/canvas&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>sorry for delay to upload code.only earth is moving into canvas.dont know how to put sun in center.</p>