examples/script/context2d/scripts/rotate.js
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 var ctx = document.getElementById('tutorial').getContext('2d');
       
     2   ctx.translate(75,75);
       
     3 
       
     4   for (i=1;i<6;i++){ // Loop through rings (from inside to out)
       
     5     ctx.save();
       
     6     ctx.fillStyle = 'rgb('+(51*i)+','+(255-51*i)+',255)';
       
     7 
       
     8     for (j=0;j<i*6;j++){ // draw individual dots
       
     9       ctx.rotate(Math.PI*2/(i*6));
       
    10       ctx.beginPath();
       
    11       ctx.arc(0,i*12.5,5,0,Math.PI*2,true);
       
    12       ctx.fill();
       
    13     }
       
    14 
       
    15     ctx.restore();
       
    16   }