svg+css实现网页鼠标滚动扑克牌老k三维翻转效果代码

代码语言:html

所属分类:加载滚动

代码描述:svg+css实现网页鼠标滚动扑克牌老k三维翻转效果代码,滚动网页试试效果。

代码标签: svg css 网页 鼠标 滚动 扑克牌 老k 三维 翻转

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

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

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
html {
  font-size: 0.7vh;
}

body {
  color: #190d23;
  font-size: 12rem;
  font-family: "Courier New";
  height: 300vh;
}

screen *, screen *:before, screen *:after {
  box-sizing: border-box;
  content: "";
  display: block;
  transform-style: preserve-3d;
  position: relative;
  perspective: 200rem;
}

screen, bg, start, scroll {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

bg {
  background: radial-gradient(#BD243F, #190d23);
  background-size: 100% 75vh;
  transform: translate3d(0, 0, 100rem);
}

text {
  position: absolute;
  right: 6rem;
  bottom: 6rem;
  color: #f5e3e3;
  opacity: 0;
  animation: show 1s linear forwards;
}
text span, text flip {
  display: inline-block;
  animation: bob 1.2s ease-in-out infinite;
}
text flip {
  animation: flip linear;
  animation-timeline: scroll();
}

@keyframes flip {
  100% {
    transform: scaleY(-1);
  }
}
@keyframes bob {
  50% {
    transform: translate3d(0, 1rem, 0);
  }
}
card {
  margin: auto;
  height: 96rem;
  width: 64.5rem;
  background: #fff;
  border-radius: 5rem;
  transform: translate3d(0, 0, 0) rotate3d(0, 0, 0, 0) rotate(1deg);
  position: relative;
  top: 6rem;
}
card *, card *:before, card *:after, card:before, card:after {
  position: absolute;
  left: 0;
  top: 0;
}
card:before, card:after {
  width: 100%;
  height: 100%;
  transform: translate3d(0, 0, -0.2rem) rotateY(180deg);
  border-radius: 5rem;
  box-shadow: inset 0 0 1rem rgba(25, 13, 35, 0.5);
  background-image: linear-gradient(to right bottom, rgba(25, 13, 35, 0.2), rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0), rgba(25, 13, 35, 0.3));
}
card:after {
  transform: translate3d(0, 0, 0.2rem) rotateY(0deg);
}

back {
  box-shadow: 0 0 0 1rem #302E9B, inset 0 0 0 1rem #302E9B, inset 0 0 0 2rem #f5e3e3;
  border-radius: 1rem;
  height: 93%;
  width: 90%;
  border: 2rem solid rgba(255, 255, 255, 0);
  background-position: 0.9rem 0.99rem;
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 0.99rem, #302E9B 0.99rem, #302E9B 1.98rem), repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 0.99rem, #302E9B 0.99rem, #302E9B 1.98rem);
  transform: translate3d(0, 0, -0.1rem) rotateY(180deg);
  bottom: 0;
  right: 0;
  margin: auto;
}

shadow {
  margin: auto;
  height: 100rem;
  width: 70rem;
  background: radial-gradient(#190d23, rgba(255, 255, 255, 0));
  background: #190d23;
  border-radius: 10rem;
  position: relative;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  transform: translate3d(0, 90rem, -50rem) rotateX(90deg) rotate(0deg) skewY(0) scale(1);
  opacity: 0.2;
  box-shadow: 0 0 2vmin #190d23, 0 0 5vmin #190d23;
}

@keyframes rotate {
  100% {
    transform: translate3d(0, 0, 0) rotate3d(1, 1, 0, -360deg) rotate(1deg);
  }
}
@keyframes light {
  0%, 100%, 50% {
    background-color: rgba(255, 255, 255, 0);
  }
  25% {
    background-color: rgba(245, 227, 227, 0.7);
  }
  75% {
    background-color: #190d23;
  }
}
@keyframes shadow {
  25% {
    transform: translate3d(0, 90rem, -50rem) rotateX(90deg) rotate(90deg) skewY(-90deg);
    opacity: 0;
  }
  50% {
    transform: translate3d(0, 90rem, -50rem) rotateX(90deg) rotate(90deg) skewY(0);
    opacity: 0.2;
  }
  75% {
    transform: translate3d(0, 90rem, -50rem) rotateX(90deg) rotate(90deg) skewY(90deg);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 90rem, -50rem) rotateX(90deg) rotate(180deg) skewY(0);
    opacity: 0.2;
  }
}
start {
  animation: hide 1s linear forwards;
}
start card {
  animation: rotate 1s linear forwards;
}
start card:before, start card:after {
  animation: light 1s linear forwards;
}
start card:after {
  animation: light 1s linear reverse;
}
start shadow {
  animation: shadow 1s linear forwards;
}

scroll {
  animation: show 1s linear forwards;
  opacity: 0;
}
scroll card {
  animation: rotate 1s linear forwards;
}
scroll card:before, scroll card:after {
  animation: light 1s linear forwards;
}
scroll card:after {
  animation: light 1s linear reverse;
}
scroll shadow {
  animation: shadow 1s linear forwards;
}
scroll card, scroll card:before, scroll card:after, scroll shadow, scroll input {
  animation-timeline: scroll();
}

@keyframes hide {
  99% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes show {
  100% {
    opacity: 1;
  }
  99% {
    opacity: 0;
  }
}
front {
  transform: translate3d(0, 0, 0.1rem) rotateY(0deg);
  height: 100%;
  width: 100%;
}
front > * {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}
front > * > *:nth-of-type(1) {
  transform: translate3d(2rem, 13rem, 0) scaleX(0.7);
  height: 4rem;
  width: 4rem;
  background: #B32B28;
  border-radius: 50%;
  box-shadow: 3.25rem 0 0 #B32B28;
}
front > * > *:nth-of-type(1):before {
  transform: translate3d(1.7rem, 1.7rem, 0) rotate(45deg);
  background: #B32B28;
  width: 4rem;
  height: 4rem;
}
front > * > *:nth-of-type(1):after {
  content: "K";
  color: #B32B28;
  transform: translate3d(0, -12rem, 0);
}
front > * > *:nth-of-type(2) {
  border: 0.5rem solid #302E9B;
  width: 68%;
  height: 79.5%;
  bottom: 0;
  right: 0;
  margin: auto;
  border-radius: 0.5rem;
  overflow: hidden;
}
front > * > *:nth-of-type(2) > *:nth-of-type(6) {
  background: #BDB725;
  box-shadow: inset 0 0 0 0.1rem #fff, inset 0 0 0 0.6rem #302E9B;
  width: 30rem;
  height: 30rem;
  transform: translate3d(7rem, -23rem, 0) rotate(37deg) skewY(20deg);
  overflow: hidden;
}
front > * > *:nth-of-type(2) > *:nth-of-type(6):after {
  background: #fff;
  width: 40rem;
  height: 10rem;
  border-radius: 50%;
  transform: translate3d(4rem, 25.5rem, 0) rotate(-50deg);
  box-shadow: 0 0 0 1.5rem #190d23;
}
front > * > *:nth-of-type(2) > *:nth-of-type(6):before {
  width: 1.5rem;
  height: 1.5rem;
  transform: translate3d(16.5rem, 26.5rem, 0) rotate(-1deg);
  background: #190d23;
  box-shadow: 0 0 0 1.5rem #BDB725, 0 0 0 2rem #190d23, 5rem -5rem 0 #190d23, 5rem -5rem 0 1.5rem #BDB725, 5rem -5rem 0 2rem #190d23, 10rem -10rem 0 #190d23, 10rem -10rem 0 1.5rem #BDB725, 10rem -10rem 0 2rem #190d23;
}
front > * > *:nth-of-type(2) > *:nth-of-type(8) {
  transform: translate3d(0.5rem, 2.5rem, 0) scaleX(0.7);
  height: 8rem;
  width: 8rem;
  background: #B32B28;
  border-radius: 50%;
  box-shadow: 6.5rem 0 0 #B32B28;
}
front > * > *:nth-of-type(2) > *:nth-of-type(8):before {
  transform: translate3d(3.25rem, 3.25rem, 0) rotate(45deg);
  background: #B32B28;
  width: 8rem;
  height: 8rem;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) {
  width: 40rem;
  height: 20rem;
  transform: translate3d(-0.5rem, 6.5rem, 0);
  border-radius: 50%;
  overflow: hidden;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7):after {
  width: 5rem;
  height: 14rem;
  border-radius: 3rem;
  transform: translate3d(21.5rem, -1rem, 0) rotate(-20deg) skewY(-10deg);
  box-shadow: 0.4rem 0.4rem 0 #302E9B, 1rem 0.8rem 0 #fff, 1.4rem 1.2rem 0 #302E9B, 2rem 1.6rem 0 #fff, 2.4rem 2rem 0 #302E9B, 3rem 2.4rem 0 #fff, 3.4rem 2.8rem 0 #302E9B, 4rem 3.2rem 0 #fff, 4.4rem 3.6rem 0 #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7):before {
  width: 1rem;
  height: 1rem;
  background: #fff;
  transform: translate3d(13.35rem, 7.85rem, 0);
  border-radius: 50%;
  box-shadow: 0.4rem 0 0 #302E9B, 0.4rem 0.4rem 0 0.3rem #fff, 0.1rem 0.4rem 0 0.6rem #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(1) {
  width: 3rem;
  height: 14rem;
  border-radius: 2rem;
  transform: translate3d(15rem, -4rem, 0) rotate(25deg);
  box-shadow: 0.4rem 0.4rem 0 #302E9B, 1rem 0.8rem 0 #fff, 1.4rem 1.2rem 0 #302E9B, 2rem 1.6rem 0 #fff, 2.4rem 2rem 0 #302E9B, 3rem 2.4rem 0 #fff, 3.4rem 2.8rem 0 #302E9B, 4rem 2.3rem 0 #fff, 4.4rem 2.6rem 0 #302E9B, 5rem 2rem 0 #fff, 5.4rem 2.1rem 0 #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(1):after {
  background: #fff;
  width: 10.8rem;
  height: 12rem;
  border-radius: 5rem 0 60% 2rem/1.25rem 0 60% 5rem;
  transform: translate3d(1.5rem, 1rem, 0) rotate(-29deg);
  box-shadow: -0.4rem -0.3rem 0 #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(1):before {
  width: 7rem;
  height: 10rem;
  border-radius: 2.5rem;
  transform: translate3d(6.5rem, 4rem, 0) rotate(-55deg);
  border: 0.4rem solid #fff;
  box-shadow: 0 0 0 0.4rem #302E9B, inset 0 0 0 0.4rem #302E9B, inset 0.5rem 0 0 0.4rem #fff, inset 0.9rem 0 0 0.4rem #302E9B, inset 1.4rem 0.2rem 0 0.4rem #fff, inset 1.8rem 0.2rem 0 0.4rem #302E9B, inset 2.3rem 0.4rem 0 0.4rem #fff, inset 2.7rem 0.4rem 0 0.4rem #302E9B, inset 3.2rem 0.8rem 0 0.4rem #fff, inset 3.6rem 0.8rem 0 0.4rem #302E9B, inset -0.5rem 0 0 0.4rem #fff, inset -0.9rem 0 0 0.4rem #302E9B, inset -1.4rem 0.2rem 0 0.4rem #fff, inset -1.8rem 0.2rem 0 0.4rem #302E9B, inset -2.3rem 0.4rem 0 0.4rem #fff, inset -2.7rem 0.4rem 0 0.4rem #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(2) {
  width: 1.5rem;
  height: 1.5rem;
  background: #fff;
  transform: translate3d(25rem, 10.65rem, 0);
  border-radius: 50%;
  box-shadow: 0.4rem 0 0 #302E9B, 0.4rem 0.4rem 0 0.4rem #fff, 0.1rem 0.4rem 0 0.6rem #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(2):after {
  width: 1rem;
  height: 1rem;
  background: #fff;
  transform: translate3d(-1.5rem, 1.2rem, 0) rotate(-70deg);
  border-radius: 50%;
  box-shadow: -0.4rem 0 0 #302E9B, -0.4rem 0.4rem 0 0.4rem #fff, -0.1rem 0.4rem 0 0.6rem #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(2):before {
  width: 0.75rem;
  height: 0.75rem;
  background: #fff;
  transform: translate3d(-11.25rem, -7rem, 0) rotate(-50deg);
  border-radius: 50%;
  box-shadow: 0.4rem 0 0 #302E9B, 0.4rem 0.4rem 0 0.3rem #fff, 0.1rem 0.4rem 0 0.6rem #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(4) {
  width: 3rem;
  height: 1rem;
  border-radius: 50%;
  border-top: 0.4rem solid #302E9B;
  transform: translate3d(21rem, 1rem, 0);
  box-shadow: -5rem 0.4rem 0 #fff, -5.5rem 0 0 #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(4):after {
  width: 0.3rem;
  height: 2rem;
  background: #302E9B;
  transform: translate3d(-2.65rem, 0, 0) rotate(-15deg);
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(4):before {
  width: 2.5rem;
  height: 5rem;
  border-radius: 2rem;
  transform: translate3d(-2.5rem, 1.25rem, 0) rotate(15deg) skewY(-10deg);
  box-shadow: -0.2rem 0.3rem 0 #302E9B;
  background: #fff;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(5) {
  width: 0.6rem;
  height: 0.6rem;
  background: #302E9B;
  border-radius: 50%;
  box-shadow: 0 0 0 0.5rem #fff, 0 0 0 0.8rem #302E9B;
  transform: translate3d(21.5rem, 3rem, 0) rotate(5deg);
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(5):before {
  width: 3.5rem;
  height: 3rem;
  border-radius: 50%;
  border-top: 0.4rem solid #302E9B;
  transform: translate3d(-1rem, -0.4rem, 0);
  box-shadow: 0 -0.8rem 0 -0.4rem #fff;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(5):after {
  width: 1.5rem;
  height: 0.75rem;
  border-radius: 50%;
  box-shadow: -0.2rem 0.2rem 0 0 #302E9B;
  transform: translate3d(-0.75rem, 1rem, 0) rotate(20deg);
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(6) {
  width: 0.6rem;
  height: 0.6rem;
  background: #302E9B;
  border-radius: 50%;
  box-shadow: 0 0 0 0.5rem #fff, 0 0 0 0.8rem #302E9B;
  transform: translate3d(16.6rem, 2.75rem, 0) rotate(5deg);
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(6):before {
  width: 3.5rem;
  height: 3rem;
  border-radius: 50%;
  border-top: 0.4rem solid #302E9B;
  transform: translate3d(-1rem, -0.4rem, 0);
  box-shadow: 0 -0.8rem 0 -0.4rem #fff;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(6):after {
  width: 1rem;
  height: 0.75rem;
  border-radius: 50%;
  box-shadow: 0 0.2rem 0 0 #302E9B;
  transform: translate3d(-0.75rem, 1rem, 0) rotate(30deg);
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(3) {
  width: 2rem;
  height: 1.25rem;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0.3rem 0 0 0 #302E9B;
  transform: translate3d(18.75rem, 6rem, 0) rotate(45deg);
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(3):before {
  width: 4rem;
  height: 4rem;
  transform: translate3d(0.25rem, 0.25rem, 0);
  box-shadow: -0.2rem -0.2rem 0 #302E9B;
  border-radius: 1rem;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(3):after {
  width: 1rem;
  height: 1rem;
  box-shadow: 0 -0.4rem 0 #302E9B;
  transform: translate3d(3.25rem, 3.25rem, 0) rotate(-45deg);
  border-radius: 50%;
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(7) {
  width: 0.6rem;
  height: 0.6rem;
  background: #302E9B;
  border-radius: 50%;
  box-shadow: 1rem 0 0 0 #302E9B, 0.5rem 0.3rem 0 0 #302E9B;
  transform: translate3d(18.75rem, 8.5rem, 0);
}
front > * > *:nth-of-type(2) > *:nth-of-type(7) > *:nth-of-type(7):after {
  width: 3.2rem;
  height: 0.5rem;
  box-shadow: 0 -0.2rem 0 #302E9B;
  transform: translate3d(-0.7rem, 0.4rem, 0);
  border-radius: 50%;
}
front > * > *:nth-of-type(2) > *:nth-of-type(5) {
  transform: translate3d(36rem, 5rem, 0);
  border: 0.3rem solid #302E9B;
  width: 2rem;
  height: 3.85rem;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0.75rem 0.3rem 0 -0.3rem #fff, 0.75rem 0.3rem 0 #302E9B, 1.75rem 0.5rem 0 -0.5rem #fff, 1.75rem 0.5rem 0 -0.2rem #302E9B, 2.65rem 0.6rem 0 -0.8rem #fff, 2.65rem 0.6rem 0 -0.4rem #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(5):before {
  transform: translate3d(-1rem, -0.75rem, 0);
  border: 0.5rem solid #302E9B;
  border-bottom: none;
  width: 1.65rem;
  height: 4rem;
  border-radius: 1rem 1rem 0 0;
  background: #fff;
}
front > * > *:nth-of-type(2) > *:nth-of-type(5):after {
  transform: translate3d(0, 3.5rem, 0);
  width: 2rem;
  height: 2rem;
  border-radius: 0 100% 0 0;
  box-shadow: 0.3rem -0.3rem 0 #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(4) {
  transform: translate3d(35.25rem, 6.5rem, 0);
  border: 0.5rem solid #302E9B;
  width: 4.75rem;
  height: 5.5rem;
  border-radius: 50%;
  background: #fff;
}
front > * > *:nth-of-type(2) > *:nth-of-type(4):before {
  transform: translate3d(4rem, -0.1rem, 0);
  width: 2rem;
  height: 2rem;
  border-radius: 100%;
  box-shadow: 0 0 0 0.5rem #302E9B, inset 0 -0.25rem 0 0.5rem #BDB725, inset 0 -0.5rem 0 1rem #302E9B;
  background: #BDB725;
}
front > * > *:nth-of-type(2) > *:nth-of-type(4):after {
  transform: translate3d(-1.5rem, -3rem, 0);
  width: 1rem;
  height: 7rem;
  border-radius: 0.5rem;
  box-shadow: 0 0 0 0.5rem #302E9B;
  background: #BDB725;
}
front > * > *:nth-of-type(2) > *:nth-of-type(3) {
  transform: translate3d(31.25rem, 6rem, 0);
  border: 0.5rem solid #302E9B;
  width: 3rem;
  height: 3rem;
  box-shadow: inset 0 0 0 0.5rem #fff, inset 0 0 0 1rem #302E9B, -3rem 0 0 0 #302E9B;
}
front > * > *:nth-of-type(2) > *:nth-of-type(3):before {
  transform: translate3d(4rem, 5rem, 0);
  width: 3.5rem;
  height: 1.5rem;
  border-radius: 50%;
  box-shadow: 0 0 0 0.5rem #302E9B;
  background: #BDB725;
}
front > * > *:nth-of-type(2) > *:nth-of-type(1) {
  transform: translate3d(30rem, 13rem, 0);
  height: 20rem;
  width: 20rem;
  background: #BDB725;
}
front > * > *:nth-of-type(2) > *:nth-of-type(1):before {
  border-radius: 50%;
  background: #fff;
  width: 10rem;
  height: 30rem;
  box-shadow: -0.4rem 0.4rem 0 0 #302E9B, -12.5rem -1rem 0 0rem #fff, -12rem -1rem 0 0rem #302E9B;
  transform: translate3d(9rem, -22rem, 0);
}
front > * > *:nth-of-type(2) > *:nth-of-type(1):after {
  background: #fff;
  width: 30rem;
  height: 20rem;
  transform: translate3d(0rem, -20rem, 0);.........完整代码请登录后点击上方下载按钮下载查看

网友评论0