jquery Implements waterfall text

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.