Before the other place saw a waterfall text, suddenly interested also imitate one, share to everybody
1 < style= "background: #000;" > 2 < ID= "C"></canvas>3 4 </ Body >
<Script> varC=document.getElementById ("C"); varCTX=C.getcontext ("2d"); //Make full ScreenC.height=Window.innerheight; C.width=window.innerwidth; //Kanji from the Unicode character set varChinese= "The years are too short, a kiss days barren."; //converts a string to a single character in an arrayChinese=Chinese.split (""); varfont_size= -; varColumns=C.width/font_size;//number of columns of rain //an array of each column vardrops= []; //here is the x-coordinate //1 = y in descent (originally the same) for(varx= 0; x<columns; x++) Drops[x]= 1; //painting functionDraw () {//Black BG's canvas //Translucent BG Display trackCtx.fillstyle= "rgba (0, 0, 0, 0.07)"; Ctx.fillrect (0, 0, C.width, c.height); Ctx.fillstyle= "#0F0"; //Font ColorCtx.font=font_size+ "px Arial"; //Looping Fonts for(varI= 0; I<drops.length; I++) { //Random Chinese character printing vartext=Chinese[math.floor (Math.random ()*Chinese.length)]; //x = i*font_size, y = value of drops[i]*font_sizeCtx.filltext (text, I*font_size, Drops[i]*font_size); //after the screen is underlined, send it at the top randomly to the top of the //add a randomness to the reset so that the dispersion is reduced on the shaft if(Drops[i]*font_size>C.height&&math.random ()> 0.975) Drops[i]= 0; //increased y-coordinateDrops[i]++; }} setinterval (Draw, -); </Script>
jquery Implements waterfall text