Html5 and css3 3D scrolling effects, html5css33d scrolling

Source: Internet
Author: User

Html5 and css3 3D scrolling effects, html5css33d scrolling

Today, we bring you a 3D rolling effect implemented by html5 and css3. As follows:

Download Online Preview source code

Implementation code.

Html code:

Html code
  1. <Div class = "container">
  2. <Div class = "cube">
  3. <Div class = "side side1">
  4. </Div>
  5. <Div class = "side side2">
  6. </Div>
  7. <Div class = "side side3">
  8. </Div>
  9. <Div class = "side side4">
  10. </Div>
  11. <Div class = "side side5">
  12. </Div>
  13. <Div class = "side side6">
  14. </Div>
  15. </Div>
  16. </Div>
  17. <Div class = "container container2">
  18. <Div class = "cube">
  19. <Div class = "side side1">
  20. </Div>
  21. <Div class = "side side2">
  22. </Div>
  23. <Div class = "side side3">
  24. </Div>
  25. <Div class = "side side4">
  26. </Div>
  27. <Div class = "side side5">
  28. </Div>
  29. <Div class = "side side6">
  30. </Div>
  31. </Div>
  32. </Div>

Css3 code:

Html code
  1. Body {
  2. Height: 100h_h;
  3. }
  4. . Container {
  5. Position: absolute;
  6. Height: 100px;
  7. Width: 100px;
  8. Left: 33%;
  9. Top: 50%;
  10. -Webkit-transform: translateX (-50%) translateY (-50% );
  11. Transform: translateX (-50%) translateY (-50% );
  12. -Webkit-perspective: 400px;
  13. Perspective: 400px;
  14. }
  15. . Cube {
  16. Height: 100px;
  17. Widht: 100px;
  18. -Webkit-transform-origin: 50% 50%;
  19. Transform-origin: 50% 50%;
  20. -Webkit-transform-style: preserve-3d;
  21. Transform-style: preserve-3d;
  22. -Webkit-animation: rotate 4S infinite transform-in-out;
  23. Animation: rotate 4S infinite transform-in-out;
  24. }
  25. . Side {
  26. Position: absolute;
  27. Display: block;
  28. Height: 100px;
  29. Width: 100px;
  30. }
  31. . Side1 {
  32. Background: # 41C3AC;
  33. -Webkit-transform: translateZ (100px );
  34. Transform: translateZ (100px );
  35. }
  36. . Side2 {
  37. Background: # FF884D;
  38. -Webkit-transform: rotateY (90deg) translateZ (100px );
  39. Transform: rotateY (90deg) translateZ (100px );
  40. }
  41. . Side3 {
  42. Background: # 32526E;
  43. -Webkit-transform: rotateY (180deg) translateZ (100px );
  44. Transform: rotateY (180deg) translateZ (100px );
  45. }
  46. . Side4 {
  47. Background: #65A2C5;
  48. -Webkit-transform: rotateY (-90deg) translateZ (100px );
  49. Transform: rotateY (-90deg) translateZ (100px );
  50. }
  51. . Side5 {
  52. Background: # FFCC5C;
  53. -Webkit-transform: rotateX (90deg) translateZ (100px );
  54. Transform: rotateX (90deg) translateZ (100px );
  55. }
  56. . Side6 {
  57. Background: # FF6B57;
  58. -Webkit-transform: rotateX (-90deg) translateZ (100px );
  59. Transform: rotateX (-90deg) translateZ (100px );
  60. }
  61. @-Webkit-keyframes rotate {
  62. 0% {
  63. -Webkit-transform: rotateX (0deg) rotateY (0deg) rotateZ (0deg );
  64. }
  65. 33.33% {
  66. -Webkit-transform: rotateX (360deg) rotateY (0deg) rotateZ (0deg );
  67. }
  68. 66.66% {
  69. -Webkit-transform: rotateX (360deg) rotateY (360deg) rotateZ (0deg );
  70. }
  71. 100% {
  72. -Webkit-transform: rotateX (360deg) rotateY (360deg) rotateZ (360deg );
  73. }
  74. }
  75. @ Keyframes rotate {
  76. 0% {
  77. Transform: rotateX (0deg) rotateY (0deg );
  78. }
  79. 50% {
  80. Transform: rotateX (360deg) rotateY (0deg );
  81. }
  82. 100% {
  83. Transform: rotateX (360deg) rotateY (360deg );
  84. }
  85. }
  86. A {
  87. Font-family: helvetica;
  88. Color: # 428bca;
  89. Text-align: center;
  90. Display: block;
  91. }
  92. . Container2 {
  93. Left: 66%;
  94. }
  95. . Container2. side {
  96. Border-radius: 50%;
  97. }

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.