CSS3 Particle Effects

Source: Internet
Author: User

    • CSS3 particle effect, particle effect, feel very good effect. Please note that this is CSS3 code, IE browser does not see the effect, please use IE9 or Firefox browser, or Chrome browser.
<!DOCTYPE HTML><HTMLLang= "en -us"><Head><MetaCharSet= "UTF-8"><title> Contact Angle measuring instrument</title></Head><Body><styletype= "Text/css">#topcanvas{position:Absolute;background:#fff;Z-index:-7;width:300px;Height:300px;}</style><Scripttype= "Text/javascript">    function$ (ID) {return typeofID=== "string" ?document.getElementById (ID): ID; }        (function(window, undefined) {if(window. ZHJ) {return; }            // }            varZHJ=window. ZHJ= {}; //Particle Effectszhj.drawpartical={drawfunction:function(ctx,r) {//Constructing particle templates--common functionsCtx.save ();                    Ctx.beginpath (); Ctx.moveto (R,0);  for(varI=0; I<Ten; I++) {ctx.rotate (Math.PI/math.random () *20);Ctx.lineto (R,0);                    } ctx.closepath ();                    Ctx.fill ();                Ctx.restore (); }, Drawimplement:function(){//particle effects--producing particles, customizing density, ColorSetInterval (function(){                        varTopccanvas= $('Topcanvas'); varCTX=Topccanvas.getcontext ('2d'); Ctx.fillstyle= '#fff';//Canvas ColorCtx.fillrect (0,0, -, Max);//the size of the fill area is 200*150Ctx.save ();                        Ctx.beginpath ();  for(varJ=1; J< -; J++){//Generate particle densityCtx.save (); Ctx.fillstyle= '#ccc';//Particle ColorCtx.translate ( --Math.floor (Math.random ()* -), the-Math.floor (Math.random ()* Max)); ZHJ.drawPartical.drawFunction (Ctx,math.floor (Math.random ()*4));//Particle GenerationCtx.restore ();                    } ctx.restore (); }, -);            }            }; ZHJ.drawPartical.drawImplement ();//Particle--page Execution Office}) (window); </Script>    <CanvasID= "Topcanvas"></Canvas></Body></HTML>

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.