- 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>