<!DOCTYPE html>
<html><canvas id=c width=500 height=500</canvas>
<script>
window.onload=function(){
c= document.getElementById('c');g= c.getContext('2d');
var planet=function(w,h,x,y,xCentr,yCentr,rad,speed,angle,col) {
that={
w:w,
h:h,
x:x,
y:y,
xCentr:xCentr,
yCentr:yCentr,
rad:rad,
speed:speed,
angle:angle,
move: function() {
x=xCentr+Math.cos(angle)*rad;
y=yCentr+Math.sin(angle)*rad;
angle+=speed;
}
,
draw: function() {
g.fillStyle=col;
g.fillRect(x,y,w,h);
}
};
return that;
};
var pandora=new planet(10,10,0,0,250,250,100,0.01,0,"#0f0");
setInterval(ris,30);
function ris(){
g.clearRect(0,0,500,500);
//g.fillRect(0,0,500,500);
pandora.move();
pandora.draw();
}
}
</script></html>