2015 a dazzling html5 special effect on New Year's Day and 2015 a special html5 special effect on New Year's Day

Source: Internet
Author: User

2015 a dazzling html5 special effect on New Year's Day and 2015 a special html5 special effect on New Year's Day

Effect Web site: http://keleyi.com/keleyi/phtml/html5/5.htm

 



Code:

Html code
  1. <! DOCTYPE html>
  2. <Html xmlns = "http://www.w3.org/1999/xhtml">
  3. <Head>
  4. <Title> A dazzling html5 special effect in 2015 on New Year's Day-ke leyi </title> <base target = "_ blank"/>
  5. <Script type = "text/javascript"> window. onload = function (){
  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. If (window. T ){
  8. If (D = 9) {D = Math. random () * 15; f (1 );}
  9. ClearTimeout (T );
  10. }
  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. C. save (); c. globalCompositeOperation = "source-over"; if (e! = 1) {c. fillStyle = "rgba (0,0, 0, 0.02)"; c. fillRect (0, 0, W, H );}
  13. C. restore (); I = 25; while (I --){
  14. C. beginPath (); if (D> 450 | bool ){
  15. If (! Bool) {bool = 1 ;}
  16. If (D <0.1) {bool = 0 ;}
  17. T-= g; D-= 0.1;
  18. }
  19. If (! Bool) {t + = g; D ++ = 0.1 ;}
  20. Q = (R/r-1) * t; x = (R-r) * C (t) + D * C (q) + (A + (X-) * (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. C. strokeStyle = "hsla (" + (U % 360) + ", 100%, 50%, 0.75)"; c. stroke (); a = x; B = y;
  22. }
  23. U-= 0.5; A = X; B = Y;
  24. }, 16 );
  25. }
  26. J. onkeydown = function (e) {a = B = 0; R ++ = 0.05}
  27. D. onmousemove ({pageX: 300, pageY: 290 })
  28. } </Script>
  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. </Head>
  31. <Body>
  32. <Div> <a href = "http://keleyi.com/"> Home </a> <a href = "http://keleyi.com/a/bjad/8e9jd0u5.htm"> original </a> <a href = "http://keleyi.com/keleyi/phtml/"> special effect Library </a> what can I do with 1 kb Javascript? </Div>
  33. <Div id = "text"> </div>
  34. <Canvas id = "keleyi_com"> </canvas>
  35. </Body>
  36. </Html>

Special effects:

Related Article

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.