图片/图形

CSS3炫酷鼠标滑过卡片3D翻转特效

阿里云


这是一款这是一款使用 CSS3 制作的效果非常炫酷的鼠标滑过卡片 3D 翻转特效。该特效开始时,图片被在 3D 空间中倾斜,当顶部滑过图片的时候,卡片平滑过渡到正常位置,卡片上的图片被缩小,同时显示出说明文字和一些链接图标。

HTML 结构

该 3D 卡片翻转特效的 HTML 结构使用 HTML5

也想出现在这里?联系我们
创客主机
元素,卡片的文字说明和链接图标使用
元素来制作。

  1. <figure id="img-wrapper">
  2.     <img src="img/1.jpg" alt="Preview Image">
  3.     <figcaption>
  4.         <h2 class="title">Hover Design Interaction</h2>
  5.         <div class="bottom-detail">
  6.             <p>......</p>
  7.             <ul class="social-icons">
  8.                 <li><a class="fa fa-qq" href="#"></a></li>
  9.                 <li><a class="fa fa-weibo" href="#"></a></li>
  10.                 <li><a class="fa fa-weixin" href="#"></a></li>
  11.                 <li><a class="fa fa-renren" href="#"></a></li>
  12.             </ul>
  13.         </div>
  14.     </figcaption>
  15. </figure>

CSS 样式

首先整个包裹元素#tri-d-wrapper 被使用 perspective 制作为 3D 空间。

  1. #tri-d-wrapper {
  2.       -webkit-perspective: 300px;
  3.       perspective: 300px;
  4.       position: absolute;
  5.       height: 100%;
  6.       width: 100%;
  7.   }

接下来

元素被绝对定位到屏幕中间,并设置了一些阴影效果。同时使用 rotateX 和 scale 将它沿 X 轴旋转并缩小。为了制作平滑的过渡效果,添加了 transition 属性。

  1. #img-wrapper {
  2.     width: 350px;
  3.     background: #3498db;
  4.     margin: 0;
  5.     position: absolute;
  6.     cursor: pointer;
  7.     border-radius: 3px;
  8.     overflow: hidden;
  9.     top: 40%;
  10.     left: 50%;
  11.     margin-left: -175px;
  12.     margin-top: -131px;
  13.     -webkit-transform: rotateX(30deg) scale(.65);
  14.     transform: rotateX(30deg) scale(.65);
  15.     -webkit-transition: .3s all ease;
  16.     transition: .3s all ease;
  17.     box-shadow: 0 15px 20px 5px rgba(0,0,0,.2);
  18. }

在鼠标滑过

元素的时候,rotateX 被置回 0 度,并且 scale 被重置为 1。

  1. #img-wrapper:hover {
  2.     -webkit-transform: rotateX(0deg) scale(1);
  3.     transform: rotateX(0deg) scale(1);
  4.     box-shadow: none;
  5. }

以上是鼠标滑过卡片是的 3D 翻转效果,其他的效果实现方法比较简单,请参考下载的源文件。

CSS3 炫酷鼠标滑过卡片 3D 翻转特效

已有 350 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!