div+css实现三维扑克牌点击翻转发牌动画效果代码

代码语言:html

所属分类:动画

代码描述:div+css实现三维扑克牌点击翻转发牌动画效果代码

代码标签: div css 三维 扑克 点击 翻转 发牌 动画

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


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  
  
  
<style>
html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding-inline: 10vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  perspective: 1000px;
  background-image: radial-gradient(#3c6cb4 30%, #244b84);
}

body,
.card,
.wrapper,
.content {
  transform-style: preserve-3d;
}

.card {
  position: absolute;
  --duration: 1200ms;
  height: 290px;
  width: 200px;
  outline: none;
  border: none;
  cursor: pointer;
  padding: 0;
  background-color: transparent;
  border-radius: 8px;
  transition: all 200ms;
  transform: rotateX(60deg);
  pointer-events: none;
  /*&::before {
    content: "";
    position: absolute;
    display: block;
    border-radius: inherit;
    width: 100%;
    height: 100%;
    background-color: hsla(0deg, 0%, 0%, 0.2);
    transition: all 200ms;
    transform: translate(5%, 5%);
    filter: blur(5px);
  }*/
}
.card:nth-child(1) {
  transform: rotateX(60deg) translateZ(3px);
}
.card:nth-child(2) {
  transform: rotateX(60deg) translateZ(6px);
}
.card:nth-child(3) {
  transform: rotateX(60deg) translateZ(9px);
}

.wrapper {
  pointer-events: initial;
  display: block;
  position: relative;
  height: 100%;
  transition: all var(--duration) ease-out;
  transform-origin: 40vw 50%;
}

.content {
  display: block;
  height: 100%;
  transition: all var(--duration);
}

.face {
  transition: transform calc(var(--duration) * 3 / 4);
  transition-delay: calc(var(--duration) / 6);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  background-size: cover;
  background-positio.........完整代码请登录后点击上方下载按钮下载查看

网友评论0