Advertisement
matrefeytontias

Checkboxes demo

Mar 5th, 2014
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <script>
  4. var t=[];
  5. var u=[-10.0,10.0,10.0,10.0,10.0,10.0,10.0,-10.0,10.0,-10.0,-10.0,10.0,-10.0,10.0,-10.0,10.0,10.0,-10.0,10.0,-10.0,-10.0,-10.0,-10.0,-10.0];
  6. function s(x,y,z){t[y*32+x].checked=z;}
  7. function cosDeg(b){return Math.cos(b*3.141592/180);}
  8. function sinDeg(b){return Math.sin(b*3.141592/180);}
  9.  
  10. function a() {
  11. theta++;
  12.  
  13. for(var i=0;i<512;i++)t[i].checked=false;
  14. for(var i=0;i<8;i++){
  15.     var x=u[i*3]*cosDeg(theta)+u[i*3+2]*sinDeg(theta);
  16.     var y=u[i*3]*(1-cosDeg(theta*2))/2+u[i*3+1]*cosDeg(theta)+u[i*3+2]*-sinDeg(theta*2)/2;
  17.     var z=u[i*3]*-sinDeg(theta*2)/2+u[i*3+1]*sinDeg(theta)+u[i*3+2]*(1+cosDeg(theta*2))/2+150;
  18.     s(Math.floor(x*64/z)+16,Math.floor(y*64/z)+8,true);
  19. }
  20.  
  21. setTimeout(a,10);
  22. }
  23. </script>
  24. </head>
  25. <body onload="a()">
  26. <div id="f" />
  27. <script>
  28. var theta=0;
  29. for(var j=0;j<16;j++){
  30.   for(var i=0;i<32;i++)
  31.     f.innerHTML+="<input type='checkbox' id='c"+(j*32+i)+"' />";
  32.   f.innerHTML+="<br />";
  33. }
  34. for(i=0;i<512;i++)
  35.   t[i]=document.getElementById("c"+i);
  36. </script>
  37. </body>
  38. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement