div+css实现卡片翻转动画效果代码

代码语言:html

所属分类:悬停

代码描述:div+css实现卡片翻转动画效果代码

代码标签: div+css 卡片 翻转 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
<style>
    .frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 400px;
  margin-top: -200px;
  margin-left: -200px;
  border-radius: 2px;
  box-shadow: 1px 2px 10px 0px rgba(0, 0, 0, 0.3);
  background: #4B4841;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.card {
  position: absolute;
  width: 320px;
  height: 180px;
  top: 110px;
  left: 40px;
  perspective: 800px;
}
.card:hover .flip {
  transform: rotateX(180deg) translate3d(0, 0, 0);
  box-shadow: 8px -10px 15px 0 rgba(0, 0, 0, 0.5);
}
.card .flip {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: all 1s ease-in-out;
  perspective: 1000px;
  box-shadow: 8px 10px 15px 0 rgba(0, 0, 0, 0.5);
}
.card .front, .card .back {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #FFCE4E;
  -webkit-backface-visibility: hidden;
          backface-visibility: hidden;
  border-radius: 3px;
  overflow: hidden;
  text-align: center;
}
.card .front {
  z-index: 2;
  transform: rotateX(0);
}
.card .front img {
  position: relative;
  top: 52px;
  -webkit-animation: bike 0.6s ease-in-out infinite;
          animation: bike 0.6s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.card .front .street {
  position: absolute;
  top: 127px;
  left: 80px;
  width: 160px;
  height: 3px;
  overflow: hidden;
}
.card .front .street .stripe-1 {
  position: absolute;
  right: -25px;
  top: 0;
  height: 3px;
  width: 4px;
  background: #4B4841;
  border-radius: 3px;
  -webkit-animation: street 0.9s linear 0.5s infinite;
          animation: street 0.9s linear 0.5s infinite;
}
.card .front .street .stripe-2 {
  position: absolute;
  right: -25px;
  top: 0;
  height: 3px;
  width: 6px;
  background: #4B4841;
  border-radius: 3px;
  -webkit-animation: street 1s linear 1s infinite;
          animation: street 1s linear 1s infinite;
}
.card .front .street .stripe-3 {
  position: absolute;
  right: -25px;
  top: 0;
  height: 3px;
  width: 8px;
  background: #4B4841;
  border-radius: 3px;
  -webkit-animation: street 1s linear 0.7s infinite;
          animation: street 1s linear 0.7s infinite;
}
.card .front .street .stripe-4 {
  position: absolute;
  right: -25px;
  top: 0;
  height: 3px;
  width: 10px;
  background: #4B4841;
  border-radius: 3px;
  -webkit-animation: street 1s linear 0.4s infinite;
          animation: street 1s linear 0.4s infinite;
}
.card .front .street .stripe-5 {
  position: absolute;
  right: -25px;
  top: 0;
  height: 3px;
  width: 12px;
  background: #4B4841;
  border-radius: 3px;
  -webkit-animation: street 1s linear 0.7s infinite;
          animation: street 1s linear 0.7s infinite;
}
.card .front .street .stripe-6 {
  position: absolute;
  right: -25px;
  top: 0;
  height: 3px;
  width: 14px;
  background: #4B4841;
  border-radius: 3px;
  -webkit-animation: street 1s linear 0.1s infinite;
          animation: street 1s linear 0.1s infinite;
}
.card .front .street .stripe-7 {
  position: absolute;
  right: -25px;
  top: 0;
  height: 3px;
  width: 16px;
  background: #4B4841;
  border-radius: 3px;
  -webkit-animation: street 0.9s linear 0.9s infinite;
          animation: street 0.9s linear 0.9s infinite;
}
.card .front .street .stripe-8 {
  position: absolute;
  right: -25px;
  top: 0;
  height: 3px;
  width: 18px;
  background: #4B4841;
  border-radius: 3px;
  -webkit-animation: street 1s linear 0.3s infinite;
          animation: street 1s linear 0.3s infinite;
}
.card .front .street .stripe-9 {
  position: absolute;
  right: -25px;
  top: 0;
  height: 3px;
  width: 20px;
  background: #4B4841;
  border-radius: 3px;
  -webkit-animation: street 1s linear 0.3s infinite;
          animation: street 1s linear 0.3s infinite;
}
.card .back {
  transform: rotateX(180deg);
}
.card .back img {
  position: relative;
  z-index: 1;
  top: 57px;
  -webkit-animation: helicopter 1.5s ease-in-out infinite;
          animation: helicopter 1.5s ease-in-out infinite;
  -webkit-animation-fill-mode: both;
          animation-fill-mode: both;
}
.card .back .sky {
  position: absolute;
  top: 0;
  left: 80px;
  bottom: 0;
  width: 160px;
  overflow: hidden;
}
.card .back .sky .cloud-1 {
  position: absolute;
  right: -25px;
  top: 34px;
  height: 3px;
  width: 12.4px;
  background: #4B4841;
  border-radius: 3px;
  -webkit-animation: cloud 0.7s linear 0.6s infinite;
          animation: cloud 0.7s linear 0.6s infinite;
}
.card .back .sky .cloud-2 {
  position: absolute;
  right: -25px;
  top: 48px;
  height: 3px;
  width: 24px;
  background: #4B4841;
  border-radius: 3px;
  -webkit-animation: cloud 0.8s .........完整代码请登录后点击上方下载按钮下载查看

网友评论0