HTML5 + Canvas + CSS3: Achieve the yunyun Effect of Sun Wukong, html5css3

Source: Internet
Author: User

HTML5 + Canvas + CSS3: Achieve the yunyun Effect of Sun Wukong, html5css3

Sun Wukong painted with HTML5 canvas, and the white clouds painted with CSS3 floated.

:

The Code is as follows:

Copy the content to the clipboard using CSS Code.
  1. <! Doctype html>
  2. <Html>
  3. <Head>
  4. <Meta charset = "UTF-8">
  5. <Meta http-equiv = "X-UA-Compatible" content = "IE = edge, chrome = 1">
  6. <Meta name = "description" content = "">
  7. <Meta name = "viewport" content = "width = device-width, initial-scale = 1">
  8. <Title> HTML5 + CSS3 implement Qi tianda shengteng cloud driving fog </title>
  9. <Style type = "text/css">
  10. *{
  11. Margin: 0;
  12. Padding: 0;
  13. Border: 0;
  14. }
  15. Html, body {
  16. Margin: 0;
  17. }
  18. @-Webkit-keyframes STAR-MOVE {
  19. From {
  20. Background-position: 0% 0%;
  21. }
  22. To {
  23. Background-position: 600% 0%;
  24. }
  25. }
  26. @ Keyframes STAR-MOVE {
  27. From {
  28. Background-position: 0% 0%;
  29. }
  30. To {
  31. Background-position: 600% 0%;
  32. }
  33. }
  34. . Wall {
  35. Position: absolute;
  36. Top: 0;
  37. Left: 0;
  38. Bottombottom: 0;
  39. Rightright: 0;
  40. }
  41. Div # background {
  42. Background: black url ('HTTP: // hovertree.com/texiao/html5/30/img/background.png') repeat-x 5% 0%;
  43. Background-size: cover;
  44. -Webkit-animation: STAR-MOVE 200 s linear infinite;
  45. -Moz-animation: STAR-MOVE 200 s linear infinite;
  46. -Ms-animation: STAR-MOVE 200 s linear infinite;
  47. Animation: STAR-MOVE 200 s linear infinite;
  48. }
  49. Div # midground {
  50. Background: url ('HTTP: // hovertree.com/texiao/html5/30/img/midground.png') repeat 20% 0%;
  51. Z-index: 1;
  52. -Webkit-animation: STAR-MOVE 100 s linear infinite;
  53. -Moz-animation: STAR-MOVE 100 s linear infinite;
  54. -Ms-animation: STAR-MOVE 100 s linear infinite;
  55. Animation: STAR-MOVE 100 s linear infinite;
  56. }
  57. Div # foreground {
  58. Background: url ('HTTP: // hovertree.com/texiao/html5/30/img/foreground.png') repeat 35% 0%;
  59. Z-index: 2;
  60. -Webkit-animation: STAR-MOVE 50 s linear infinite;
  61. -Moz-animation: STAR-MOVE 50 s linear infinite;
  62. -Ms-animation: STAR-MOVE 50 s linear infinite;
  63. Animation: STAR-MOVE 50 s linear infinite;
  64. } # Hovertreewk {position: absolute; z-index: 9999; top: 0px; bottombottom: 0px; left: 0px; rightright: 0px; margin: auto ;}
  65. </Style>
  66. </Head>
  67. <Body>
  68. <Div style = "text-align: center; position: absolute; z-index: 9; color: white">
  69. <Div id = "background" class = "wall"> </div>
  70. <Div id = "midground" class = "wall"> </div>
  71. <Div id = "foreground" class = "wall"> </div>
  72. <Canvas width = "650" height = "478" id = "hovertreewk"> </canvas>
  73. <Script src = "http://hovertree.com/texiao/html5/30/js/hovertreewk.js"> </script>
  74. </Body>
  75. </Html>

We have finished introducing the HTML5 + Canvas + CSS3 code for achieving the legend of Sun Wukong, and hope to help you!

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.