<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Solar System</title>
<style type="text/css">
*{
margin:0;
padding:0;
font-family:"Helvetica";
}
body{
background:black;
user-select: none;
}
ul{
list-style:none;
}
li{
display:inline-block;
}
canvas{
margin: 0;
width: 100%;
height: 100%;
display: block;
position: absolute;
top: 0;
left: 0;
}
</style>
<body data-rsssl=1>
<canvas id="canvas" height="800" width="800"></canvas>
<script type="text/javascript">
window.onload = function(){
if(navigator.appVersion.indexOf("MSIE 7.") != -1 || navigator.appVersion.indexOf("MSIE 8.") != -1){
alert("Please don't use old IE browser");
}
var canvas = document.getElementById("canvas"),
ctx = canvas.getContext("2d"),
cw = canvas.width,
ch = canvas.height,
time = 1;
window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function(callback){window.setTimeout(callback, 1000/60);}
function circle(radius,color,x,y){
x = typeof x !== "undefined" ? x : cw/2;
y = typeof y !== "undefined" ? y : ch/2;
ctx.beginPath();
ctx.fillStyle = color;
ctx.arc(x,y,radius,0,2*Math.PI,true);
ctx.fill();
ctx.closePath();
}
function circleStroke(radius,strokeColor,x,y,lineWidth){
ctx.beginPath();
ctx.arc(x,y,radius,0,2*Math.PI,true);
ctx.lineWidth = lineWidth;
ctx.strokeStyle = strokeColor;
ctx.stroke();
ctx.closePath();
}
function line(ax,ay,bx,by){
ctx.beginPath();
ctx.moveTo(ax*2,ay);
ctx.lineTo(bx,by);
ctx.strokeStyle = "rgba(255, 255, 255,0.12)";
ctx.stroke();
ctx.closePath();
}
function text(text,color,font,x,y){
ctx.beginPath();
ctx.font = font;
ctx.fillStyle = color;
ctx.fillText(text,x,y);
ctx.closePath();
}
function animate(){
ctx.save();
ctx.beginPath();
ctx.fillStyle = "black";
ctx.fillRect(0,0,cw,ch);
ctx.closePath();
ctx.translate(cw/2,ch/2);
circle(25,"red",0,0);
text("Sun", "black","15pt arial", -16,7);
circleStroke(40,"#1c1c1c",0,0,"1");
ctx.rotate(time / 30);
ctx.translate(40,0);
circle(3.8,"#898989",0,0);
line(-40,0,0,0);
ctx.translate(-40,0);
circleStroke(60,"#1c1c1c",0,0,"1");
ctx.rotate(time / 100 - (time / 90));
ctx.translate(60,0);
circle(9,"#b9955b",0,0);
line(-60,0,0,0);
ctx.translate(-60,0);
circleStroke(90,"#1c1c1c",0,0,"2");
ctx.rotate(time / 100 - (time / 80));
ctx.translate(90,0);
circle(10,"#2f2fc1",0,0);
line(-90,0,0,0);
ctx.translate(-90,0);
circleStroke(120,"#1c1c1c",0,0,"2");
ctx.rotate(time / 120 - (time / 50));
ctx.translate(120,0);
circle(15,"#9f5e13",0,0);
line(-120,0,0,0);
ctx.translate(-120,0);
circleStroke(160,"#151515",0,0,"35");
ctx.translate(0,0);
circleStroke(220,"#1c1c1c",0,0,"2");
ctx.rotate(time / 120 - (time / 50));
ctx.translate(220,0);
circle(45,"#ef602c",0,0);
line(-220,0,0,0);
ctx.translate(-220,0);
circleStroke(300,"#1c1c1c",0,0,"2");
ctx.rotate(time / 120 - (time / 90));
ctx.translate(300,0);
circle(35,"#c76743",0,0);
line(-300,0,0,0);
ctx.translate(0,0);
circleStroke(50,"#747474",0,0,"3");
ctx.translate(-300,0);
circleStroke(340,"#1c1c1c",0,0,"2");
ctx.rotate(time / 120 - (time / 90));
ctx.translate(-340,0);
circle(23,"#b843c7",0,0);
line(340,0,0,0);
ctx.translate(340,0);
circleStroke(380,"#1c1c1c",0,0,"2");
ctx.rotate(time / 120 - (time / 140));
ctx.translate(-380,0);
circle(20,"#43aec7",0,0);
line(380,0,0,0);
ctx.restore();
time++;
window.requestAnimationFrame(animate);
}
window.requestAnimationFrame(animate);
}
</script>
</body>