var canvas = document.getElementById("canvas");
var cxt = canvas.getContext('2d');
var time = 0;
var EarchRotate = 0;
var MoonX = 0;
var MoonY = 0;
function starRoute(){
for(var i=0; i<=8; i++){
cxt.save();
cxt.translate(500,500);
cxt.strokeStyle = '#fff';
cxt.beginPath();
cxt.arc(0,0,i*55,0,2*Math.PI,false);
cxt.closePath();
cxt.stroke();
cxt.restore();
}
}
function Star(name,x,y,r,startColor,endColor,revolution){
this.name = name;
this.x = x;
this.y = y;
this.r = r;
this.startColor = startColor;
this.endColor = endColor;
this.revolution = revolution;
}
Star.prototype = {
constructor : Star,
drawStar : function(){
cxt.save();
cxt.translate(500,500);
var gradient = cxt.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r);
gradient.addColorStop(0,this.startColor);
gradient.addColorStop(1,this.endColor);
cxt.fillStyle = gradient;
cxt.beginPath();
if(this.name == '地球'){
EarchRotate = time*360/this.revolution*Math.PI/180;