BONUMMASTERPH

SagarCommunity

Oct 9th, 2020 (edited)
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.37 KB | None | 0 0
  1. <!-- Created by undergroundsecurity -->
  2.  
  3. <!-- Created by ㅤㅤBONUMMASTERㅤㅤ -->
  4.  
  5.  
  6. <!--
  7. original code link
  8. <a href=" https://codepen.io/P3R0/pen/MwgoKv?__cf_chl_jschl_tk__=f3df7036af76969ea48d78a0b02027e43c6e6095-1600334970-0-AUbo_0lP07TKrlI42Y-C2jG9aIn4f4w9YBExxkkAMAQmKZOf1er-SR3C8i0MkqFV_nkNpp4Rtoi8aTGzOL8OCfA8zcT4NpOaSbWm_xjKP1K_YfaoQCvhCpX5110KyFzIVKXt6BBN8W6v5Tfi6RGT6C5gvin9_NQru8axyDd9ASu7Y5GMpXR-Z_kjxb-xdkRlxBxNLc3HL_78zgefmfjsfcUeWmWVZhLGl4YILELYuBYYOMTl5tN3UoKWpPz8dyoW1tFQ4nhcwwdLr-AZIs_1noRH6klkzaaXFD297YAhghj6G7CFJ34KeJMX7bN6u093c3z9BvCmyuDPHKy9OglAECinQSO8j92OrMNW2mMZUEXk">Click Here for Original code</a>-->
  9.  
  10. <!DOCTYPE html>
  11. <html>
  12.     <head>
  13.         <title>Code Rain</title>
  14.  
  15.        
  16.         <style>
  17.            
  18.             /*basic reset */
  19.            
  20.             *{
  21.                 margin: 0;
  22.                 padding: 0;
  23.             }
  24.            
  25.             body {background: black;}
  26.             canvas {display:block;
  27.            
  28.             height:100%;
  29.             width:100%;
  30.             }
  31.        
  32.         </style>
  33.     </head>
  34.    
  35.     <body>
  36.         <canvas id="c"></canvas>
  37.        
  38.         <script>
  39.         // geting canvas by id c
  40.         var c = document.getElementById("c");
  41.         var ctx = c.getContext("2d");
  42.  
  43.         //making the canvas full screen
  44.         c.height = window.innerHeight;
  45.         c.width = window.innerWidth;
  46.  
  47.        
  48.         var matrix = "f3tcher";
  49.         //converting the string into an array of single characters
  50.         matrix = matrix.split("");
  51.  
  52.         var font_size = 10;
  53.         var columns = c.width/font_size; //number of columns for the rain
  54.         //an array of drops - one per column
  55.         var drops = [];
  56.         //x below is the x coordinate
  57.         //1 = y co-ordinate of the drop(same for every drop initially)
  58.         for(var x = 0; x < columns; x++)
  59.            drops[x] = 1;
  60.  
  61.        //drawing the characters
  62.        function draw()
  63.        {
  64.            //Black BG for the canvas
  65.            //translucent BG to show trail
  66.            ctx.fillStyle = "rgba(0, 0, 0, 0.04)";
  67.            ctx.fillRect(0, 0, c.width, c.height);
  68.  
  69.            ctx.fillStyle = getRandomColor(); //green text
  70.            ctx.font = font_size + "px arial";
  71.            //looping over drops
  72.            for(var i = 0; i < drops.length; i++)
  73.            {
  74.                //a random chinese character to print
  75.                var text = matrix[Math.floor(Math.random()*matrix.length)];
  76.                //x = i*font_size, y = value of drops[i]*font_size
  77.                ctx.fillText(text, i*font_size, drops[i]*font_size);
  78.  
  79.                //sending the drop back to the top randomly after it has crossed the screen
  80.                //adding a randomness to the reset to make the drops scattered on the Y axis
  81.                if(drops[i]*font_size > c.height && Math.random() > 0.975)
  82.                    drops[i] = 0;
  83.  
  84.                 //incrementing Y coordinate
  85.                 drops[i]++;
  86.             }
  87.         }
  88.  
  89.         setInterval(draw, 30);
  90.  function getRandomColor() {
  91.               var letters = '0123456789ABCDEF';
  92.               var color = '#';
  93.               for (var i = 0; i < 6; i++) {
  94.                color += letters[Math.floor(Math.random() * 16)];
  95.              }
  96.              return color;
  97.            }
  98.        
  99.        </script>
  100.    
  101.        
  102.     </body>
  103. </html>
Add Comment
Please, Sign In to add comment