马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
下雪了 html 代码特效
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Document</title>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
- <script src="https://www.zachstronaut.com/js/rotate.jquery.js"></script>
- <style>
- body {
- background: #111;
- }
- </style>
- </head>
- <body>
- <script>
- !function(t){var a,o=0,e=0,n=0,r=0,h=0,d=!0,s=0,i=["❄","❅","❆"],p=200,x=0;function f(a){x++;var n=[{r:1,css:{fontSize:15+Math.floor(20*Math.random())+"px",textShadow:"9999px 0 0 rgba(238, 238, 238, 0.5)"},v:2},{r:.6,css:{fontSize:50+Math.floor(20*Math.random())+"px",textShadow:"9999px 0 2px #eee"},v:6},{r:.2,css:{fontSize:90+Math.floor(30*Math.random())+"px",textShadow:"9999px 0 6px #eee"},v:12},{r:.1,css:{fontSize:150+Math.floor(50*Math.random())+"px",textShadow:"9999px 0 24px #eee"},v:20}],r=t('<span class="winternetz">'+i[Math.floor(Math.random()*i.length)]+"</span>").css({color:"#eee",display:"block",position:"fixed",background:"transparent",width:"auto",height:"auto",margin:"0",padding:"0",textAlign:"left",zIndex:9999});d&&r.css("textIndent","-9999px");for(var h=Math.random(),s=n.length,p=0;s--;)if(h<n[s].r){p=n[s].v,r.css(n[s].css);break}var f=-300+Math.floor(Math.random()*(o+300)),M=0;M=void 0!==a&&a?-300+Math.floor(Math.random()*(e+300)):-300,r.css({left:f+"px",top:M+"px"}),r.data("x",f),r.data("y",M),r.data("v",p),r.data("half_v",Math.round(.5*p)),t("body").append(r)}function M(){Math.random()>.8&&(s+=2*Math.random()-1,Math.abs(s)>3&&(s=s/Math.abs(s)*3));var e=(new Date).getTime(),d=e-a;a=e,d<55&&x<p?f():d>150&&(t("span.winternetz:first").remove(),x--),t("span.winternetz").each(function(){var a=t(this).data("x"),e=t(this).data("y"),d=t(this).data("v"),i=t(this).data("half_v");e+=d,a+=Math.round(s*d),(a+=-i+Math.round(Math.random()*d))>n?a=-300:a<r&&(a=o),e>h?(t(this).remove(),x--,f()):(t(this).data("x",a),t(this).data("y",e),t(this).css({left:a+"px",top:e+"px"}),d>=6&&t(this).animate({rotate:"+="+i+"deg"},0))})}t(function(){var s=function(){o=t(window).width(),e=t(window).height(),n=o+300,r=-300,h=e+300};s(),t(window).resize(s),t("body").css("textShadow")||(d=!1);var i=50;for(;i--;)f(!0);a=(new Date).getTime(),setInterval(M,50)})}(jQuery);
- </script>
- </body>
- </html>
复制代码
|