&l..._3d旋转相册点击全屏">
当前位置:   article > 正文

HTML5 3D旋转图片相册

3d旋转相册点击全屏

H5旋转3D相册,鼠标放置暂停,图片灰度级为0,有放大效果。

该实例运用H5和CSS3动画效果,未用javascript。提高了本人对CSS3 新属性的了解及掌握。

完整代码如下:

 

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>HTML5 3D旋转图片相册 可鼠标悬停</title>
  6. <style>
  7. *{
  8. padding: 0;
  9. margin: 0;
  10. border: none;
  11. outline: none;
  12. box-sizing: border-box;
  13. }
  14. *:before,*:after{
  15. box-sizing: border-box;
  16. }
  17. html,body{
  18. min-height: 100%;
  19. }
  20. body{
  21. background-image: radial-gradient(mintcream 0%, lightgray 100%);;
  22. }
  23. .Container{
  24. margin: 4% auto;
  25. width: 210px;
  26. height: 140px;
  27. position: relative;
  28. perspective: 1000px;
  29. }
  30. #carousel{
  31. width: 100%;
  32. height: 100%;
  33. position: absolute;
  34. transform-style:preserve-3d;
  35. animation: rotation 20s infinite linear;
  36. }
  37. #carousel:hover{
  38. animation-play-state: paused;
  39. }
  40. #carousel figure{
  41. display: block;
  42. position: absolute;
  43. width: 220px;
  44. height: 120px;
  45. left: 10px;
  46. top: 10px;
  47. background: black;
  48. overflow: hidden;
  49. border: solid 5px black;
  50. }
  51. img{
  52. filter: grayscale(1);
  53. cursor: pointer;
  54. transition:all 0.3s ease 0s;
  55. width: 100%;
  56. height: 100%;
  57. }
  58. img:hover{
  59. filter: grayscale(0);
  60. transform: scale(1.2,1.2);
  61. }
  62. #carousel figure:nth-child(1){transform: rotateY(0deg) translateZ(288px);}
  63. #carousel figure:nth-child(2) { transform: rotateY(60deg) translateZ(288px);}
  64. #carousel figure:nth-child(3) { transform: rotateY(120deg) translateZ(288px);}
  65. #carousel figure:nth-child(4) { transform: rotateY(180deg) translateZ(288px);}
  66. #carousel figure:nth-child(5) { transform: rotateY(240deg) translateZ(288px);}
  67. #carousel figure:nth-child(6) { transform: rotateY(300deg) translateZ(288px);}
  68. @keyframes rotation{
  69. from{
  70. transform: rotateY(0deg);
  71. }
  72. to{
  73. transform: rotateY(360deg);
  74. }
  75. }
  76. </style>
  77. </head>
  78. <body>
  79. <div class="Container">
  80. <div id="carousel">
  81. <figure><img src="../myWeb/素材/5cms.jpg" alt=""></figure>
  82. <figure><img src="../myWeb/素材/5cms2.jpg" alt=""></figure>
  83. <figure><img src="../myWeb/素材/5cms3.jpg" alt=""></figure>
  84. <figure><img src="../myWeb/素材/5cms4.jpg" alt=""></figure>
  85. <figure><img src="../myWeb/素材/5cms5.jpg" alt=""></figure>
  86. <figure><img src="../myWeb/素材/5cms6.jpg" alt=""></figure>
  87. </div>
  88. </div>
  89. </body>
  90. </html


 


 

转载于:https://www.cnblogs.com/youth-dream/p/7219462.html

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号