特效描述:html5 canvas 太阳系 九大行星运行 动态图代码。html5 canvas这个动画加上了每个行星的名称,只要鼠标移入目标行星就会显示。
代码结构
1. HTML代码
你浏览器不支持
window.οnlοad=function(){
var oImg=new Image();
oImg.src="img.png";
oImg.offOn=false;
oImg.οnlοad=function(){
oImg.offOn=true;
};
/*行星数据存储*/
var planetData=[{
type:"mercury",
speed:100,
location:220,
r:100,
tw:222,
th:220,
sw:30,
sh:30,
num:100,
count:460,
fontShow:false
},{
type:"Venus",
speed:100,
location:440,
r:150,
tw:228,
th:228,
sw:36,
sh:36,
num:200,
count:560,
fontShow:false
},{
type:"earth",
r:220,
speed:100,
location:668,
tw:252,
th:252,
sw:40,
sh:40,
num:400,
count:760,
fontShow:false
},{
type:"Mars",
r:300,
speed:100,
location:920,
tw:275,
th:276,
sw:50,
sh