Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <body id="c" bgcolor="#000000">
  3. <canvas id="cv1" style="position:fixed; top:0;left:0; z-index:-1;"></canvas>
  4. <div id="hehe"style="text-align:center;color:green;font-size:60px;"></div>
  5. <script type="text/javascript" src="j.js"></script>
  6. </body>
  7. </html>
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14. var canvas=document.getElementById("cv1");
  15. var ww=window.innerWidth;
  16. var wh=window.innerHeight;
  17. canvas.setAttribute("height", wh);
  18. canvas.setAttribute("width", ww);
  19. canvas.setAttribute("id", "canvas");
  20.  
  21. function add(){
  22.     this.x=Math.random()*ww-ww/2;
  23.     this.y=Math.random()*wh-wh/2;
  24.     this.sz=3;
  25. }
  26. var b=new Array();
  27. for(var i=0;i<50;i++){
  28.     b.push(new add());
  29. }
  30.  
  31. if (window.Event) {
  32.     document.captureEvents(Event.MOUSEMOVE);
  33. }
  34.  
  35. var mx=0;
  36. var my=0;
  37. function mpos(e) {
  38.     mx=(window.Event) ? e.pageX : event.clientX +
  39.                     (document.documentElement.scrollLeft ?
  40.                         document.documentElement.scrollLeft :
  41.                         document.body.scrollLeft);
  42.     my=(window.Event) ? e.pageY : event.clientY +
  43.                     (document.documentElement.scrollTop ?
  44.                         document.documentElement.scrollTop :
  45.                         document.body.scrollTop);
  46.                    
  47.     mx -= ww / 2;
  48.     my -= wh / 2;
  49.  
  50. }
  51. document.onmousemove = mpos;
  52. var img=new Image();
  53. img.src="asd.gif";
  54. var canv=canvas.getContext("2d");
  55. var speed=1.003;
  56. var transparacy=0.3;
  57. var alpha=0;
  58. var hehe=true;
  59. var hehex=0;
  60. var hehey=0;
  61. var hehesz=0;
  62. function run(){
  63.     if(!hehe && Math.round(Math.random()*5)==5){
  64.         canv.fillStyle="rgba("+Math.round(Math.random()*255)+","+Math.round(Math.random()*255)+","+Math.round(Math.random()*255)+",1)";
  65.     }else{
  66.         canv.fillstyle="rgba(0,0,0,1)";
  67.     }
  68.     canv.fillRect(0,0,ww,wh);
  69.     for(var i in b){
  70.         if(Math.abs(b[i].x)>ww/2 || Math.abs(b[i].y)>wh/2){
  71.             b[i]=new add();
  72.         }
  73.         b[i].x*=speed;
  74.         b[i].y*=speed;
  75.         b[i].y-=(b[i].sz-1)*(1+my*0.01);
  76.         b[i].x-=(b[i].sz-1)*(1+mx*0.01);
  77.         b[i].sz*=speed;
  78.         canv.drawImage(img,b[i].x+600,b[i].y+450, b[i].sz,b[i].sz);
  79.         if(hehe){
  80.             if(b[i].sz>400){
  81.                 document.getElementById("hehe").innerHTML="HURRA";
  82.                 hehe=false;
  83.                 hehex=b[i].x+600;
  84.                 hehey=b[i].y+450;
  85.                 hehesz=b[i].sz
  86.             }
  87.         }
  88.     }
  89.     if(!hehe){
  90.             canv.drawImage(img,hehex,hehey,hehesz,hehesz);
  91.         }
  92. }
  93.  
  94. setInterval(run, 30/1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement