3 4 2015元旦来个炫的html5特效-柯乐义 5
当前位置:   article > 正文

2015元旦来个炫的html5特效_元旦代码特效

元旦代码特效

效果网址:http://keleyi.com/keleyi/phtml/html5/5.htm

元旦

代码:

  1. 1 <!DOCTYPE html>
  2. 2 <html xmlns="http://www.w3.org/1999/xhtml">
  3. 3 <head>
  4. 4 <title>2015元旦来个炫的html5特效-柯乐义</title><base target="_blank" />
  5. 5 <script type="text/javascript"> window.onload = function () {
  6. 6 C = Math.cos; S = Math.sin; U = 0; w = window; j = document; d = j.getElementById("kele"+"yi_com"); c = d.getContext("2d"); W = d.width = w.innerWidth; H = d.height = w.innerHeight; c.fillRect(0, 0, W, H); c.globalCompositeOperation = "lighter"; c.lineWidth = 0.2; c.lineCap = "round"; var bool = 0, t = 0; d.onmousemove = function (e) {
  7. 7 if (window.T) {
  8. 8 if (D == 9) { D = Math.random() * 15; f(1); }
  9. 9 clearTimeout(T);
  10. 10 }
  11. 11 X = e.pageX; Y = e.pageY; a = 0; b = 0; A = X, B = Y; R = (e.pageX / W * 999 >> 0) / 999; r = (e.pageY / H * 999 >> 0) / 999; U = e.pageX / H * 360 >> 0; D = 9; g = 360 * Math.PI / 180; T = setInterval(f = function (e) {
  12. 12 c.save(); c.globalCompositeOperation = "source-over"; if (e != 1) { c.fillStyle = "rgba(0,0,0,0.02)"; c.fillRect(0, 0, W, H); }
  13. 13 c.restore(); i = 25; while (i--) {
  14. 14 c.beginPath(); if (D > 450 || bool) {
  15. 15 if (!bool) { bool = 1; }
  16. 16 if (D < 0.1) { bool = 0; }
  17. 17 t -= g; D -= 0.1;
  18. 18 }
  19. 19 if (!bool) { t += g; D += 0.1; }
  20. 20 q = (R / r - 1) * t; x = (R - r) * C(t) + D * C(q) + (A + (X - A) * (i / 25)) + (r - R); y = (R - r) * S(t) - D * S(q) + (B + (Y - B) * (i / 25)); if (a) { c.moveTo(a, b); c.lineTo(x, y) }
  21. 21 c.strokeStyle = "hsla(" + (U % 360) + ",100%,50%,0.75)"; c.stroke(); a = x; b = y;
  22. 22 }
  23. 23 U -= 0.5; A = X; B = Y;
  24. 24 }, 16);
  25. 25 }
  26. 26 j.onkeydown = function (e) { a = b = 0; R += 0.05 }
  27. 27 d.onmousemove({ pageX: 300, pageY: 290 })
  28. 28 }</script>
  29. 29 <style>body{margin:0;overflow:hidden}div{padding:1px 5px;background:#333;position:absolute;z-index:2;color:#555;font-family:arial}a{color:#ccf}a:hover{color:red}</style>
  30. 30
  31. 31 </head>
  32. 32 <body>
  33. 33 <div><a href="http://keleyi.com/">首页</a> <a href="http://keleyi.com/a/bjad/8e9jd0u5.htm">原文</a> <a href="http://keleyi.com/keleyi/phtml/">特效库</a> 1kb的Javascript能干什么?</div>
  34. 34 <div id="text"></div>
  35. 35 <canvas id="keleyi_com"></canvas>
  36. 36 </body>
  37. 37 </html>

web前端:http://www.cnblogs.com/jihua/p/webfront.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/96342
推荐阅读
相关标签
  

闽ICP备14008679号