中文(简体)
<!-- http://www.downcodes.com/js --> <!-- bbs http://www.downcodes.com/bbs--> <head> <style> .point{ 位置:绝对;宽度:10;高度:10;背景颜色:#AAAAAA;溢出:隐藏} </style> <script> speed=4;点=新数组();角度=速度; rotXok=真; rotYok=真; rotZok=假;函数 Obj(div){return this;} objpro=Obj.prototype; objpro.moveTo=函数(x,y,z){this.x=(x);这个.y=(y);这个.z=z; } 点=新数组();函数 movemat(){ /* 2 - 1 1=1,2 2,3,7,6 // 2=3,4 1,5,8,4 3 - 4 3=5,6 4=7,8 6 - 5 5=9,10 // 6=11,12 7 - 8 7=13,14 8=15,16 */ pt1=Math.round(points[1].x); pt2=Math.floor(points[1].y); pt3=Math.floor(points[2].x); pt4=Math.floor(points[2].y); pt5=Math.floor(points[3].x); pt6=Math.floor(points[3].y); pt7=Math.floor(points[4].x); pt8=Math.floor(points[4].y); pt9=Math.floor(points[5].x); pt10=Math.floor(points[5].y); pt11=Math.floor(points[6].x); pt12=Math.floor(points[6].y); pt13=Math.floor(points[7].x); pt14=Math.floor(points[7].y); pt15=Math.floor(points[8].x); pt16=Math.floor(points[8].y); sq1="m "+pt1+","+pt2+" l "+pt3+","+pt4+" "+pt5+", "+pt6+" "+pt7+", "+pt8+" xe"; sq2="m "+pt9+","+pt10+" l "+pt11+","+pt12+" "+pt13+","+pt14+" "+pt15+","+pt16+" xe"; sq3="m "+pt3+","+pt4+" l "+pt5+","+pt6+" "+pt13+","+pt14+" "+pt11+","+pt12+" xe"; sq4="m "+pt1+","+pt2+" l "+pt9+","+pt10+" "+pt15+","+pt16+" "+pt7+","+pt8+" xe"; v1.path=sq1; v2.path=sq2; v3.path=sq3; v4.path=sq4} 函数 init(){ for(i=1; i <=8; i++){ 点[i]=new Obj('v'+i);} 点[1].x=45;点[1].y=15;点[1].z=60;点[2].x=15;点[2].y=15;点[2].z=60;点[3].x=15;点[3].y=15;点[3].z=90;点[4].x=45;点[4].y=15;点[4].z=90;点[5].x=45;点[5].y=45;点[5].z=60;点[6].x=15;点[6].y=45;点[6].z=60;点[7].x=15;点[7].y=45;点[7].z=90;点[8].x=45;点[8].y=45;点[8].z=90; for(i=1; i <=8; i++){ 点[i].moveTo(点[i].x,点[i].y,点[i].z)} } 函数 rot(){ a =degToRad(角度); a2=degToRad(角度); for(i=1; i <= 8; i++){ mat=[points[i].x,points[i].y,points[i].z-75,1]; rotX=[[1,0,0,0],[0,Math.cos(a),-Math.sin(a),0],[0,Math.sin(a),Math.cos(a) ,0],[0,0,0,1]]; rotY=[[Math.cos(a2),0,Math.sin(a2),0],[0,1,0,0],[-Math.sin(a2),0,Math.cos(a2) ,0],[0,0,0,1]]; rotZ=[[数学.cos(a),-数学.sin(a),0,0],[数学.sin(a),数学.cos(a),0,0],[0,0,1 ,0],[0,0,0,1]]; if(rotXok){mat=matrixMultiply(mat,rotX)}; if(rotYok){mat=matrixMultiply(mat,rotY)}; if(rotZok){mat=matrixMultiply(mat,rotZ)};点[i].x=mat[0];点[i].y=mat[1];点[i].z=mat[2] + 75;点[i].moveTo(点[i].x,点[i].y,点[i].z);移动垫(); setTimeout('rot()',50); } 函数矩阵乘法(A,B) { var retVal=[0,0,0]; for(var i=0;i<4;i++) { retVal[i]=0; for(var s=0;s<4;s++) retVal[i] += A[s] * B[i][s] } return retVal;圆周率=3.14159;函数 degToRad(x) { return (( x/(360/(2*pi)) )); } function rotok(oked){ Xok=document.getElementById('rotateX').checked; if(Xok){rotXok=true}else{rotXok=false} Yok=document.getElementById('rotateY').checked; if(Yok){rotYok=true}else{rotYok=false} Zok=document.getElementById('rotateZ').checked; if(Zok){rotZok=true}else{rotZok=false} } </script> <style type="text/css"> v:*{behavior:url(#default#VML);} </style> </head> <body bgcolor="black" text="darkblue"> <script> for(i=1; i <= 4; i++){ document.write('<v:shape id="v'+i+ '" 填充 = "假" 笔划颜色 = "黄色" 样式 = "位置:绝对;左:50;顶部:50;宽度:200;高度:200" coordorigin = "0, 0" coordsize = "60,60"> ' +'<v:path v="m 0,0 l 100,0 100,100 0,100 0,100 xe"/></v:shape>'); }init();rot()</script> <br><br><br> <p><font color=red>//休闲请佛教出处:建站学院。</font></p>