svg+css实现三维逼真银行卡片旋转动画效果代码

代码语言:html

所属分类:布局界面

代码描述:svg+css实现三维逼真银行卡片旋转动画效果代码

代码标签: svg css 三维 逼真 银行 卡片 旋转 动画

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


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

<head>

  <meta charset="UTF-8">

  <link href="https://fonts.googleapis.com/css2?family=PT+Mono&amp;family=Space+Grotesk:wght@300;400;500;600;700&amp;display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">

  <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Heebo:100,300,400,500,700,800,900'>
  
<style>
:root {
  --glitter: url("//repo.bfw.wiki/bfwrepo/image/63e331b8add37.png");
  --duration: 6.66s;
}

.card-front:before {
  content: "";
  inset: 0;
  position: absolute;
  transform: translate3d(0, 0, 0.01px);
  background-image: var(--glitter), var(--glitter), linear-gradient(120deg, black 25%, white, black 75%);
  background-size: 100% 100%, 80% 80%, 200% 200%;
  background-blend-mode: multiply, multiply, overlay;
  background-position: 50% 50%, 50% 50%, 50% 50%;
  mix-blend-mode: color-dodge;
  filter: brightness(2) contrast(0.8);
  -webkit-animation: bg var(--duration) ease infinite;
          animation: bg var(--duration) ease infinite;
}

.card-front {
  display: grid;
  position: relative;
  transform: translate3d(0, 0, 0.01px);
  width: 90vw;
  max-width: 580px;
  aspect-ratio: 3/2;
  border-radius: 3.5% 3.5% 3.5% 3.5%/5% 5% 5% 5%;
  background-image: url(//repo.bfw.wiki/bfwrepo/icon/637977059b93a.png);
  background-size: cover;
  box-shadow: 0 30px 40px -25px #0f0514, 0 20px 50px -15px #0f0514;
  overflow: hidden;
  -webkit-animation: tilt var(--duration) ease infinite;
          animation: tilt var(--duration) ease infinite;
  image-rendering: optimizequality;
}

.card-front * {
  font-family: PT Mono, monospace;
}

.cardLogo,
.expiry,
.name,
.number,
.chip,
.icon {
  position: absolute;
  margin: 0;
  padding: 0;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  font-size: clamp(0.75rem, 2.8vw + 0.2rem, 1.1rem);
  inset: 5%;
  text-shadow: 0 2px 1px rgba(0, 0, 0, 0.125), 1px 1px 1px rgba(0, 0, 0, 0.125), 1px 1px 1px rgba(0, 0, 0, 0.125);
}

.name, .number, .expiry {
  background-image: linear-gradient(to bottom, #ddd 20%, #999 70%), none, linear-gradient(120deg, transparent 10%, white 40%, white 60%, transparent 90%);
  background-size: cover, cover, 200%;
  background-position: 50% 50%;
  background-blend-mode: overlay;
  color: white;
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  -webkit-animation: bg var(--duration) ease infinite;
          animation: bg var(--duration) ease infinite;
}

.number {
  font-family: PT Mono, monospace;
  text-align: center;
  font-size: clamp(1rem, 8vw - 0.5rem, 2.5rem);
  letter-spacing: 0.025em;
  top: 60%;
  bottom: auto;
}

.expiry,
.name {
  top: auto;
}

.name {
  right: auto;
  max-width: 180px;
  line-height: 1.2;
  text-align: left;
}

.expiry {
  left: auto;
}

.cardLogo {
  bottom: auto;
  left: auto;
  width: 15%;
  filter: saturate(0) brightness(1.25) contrast(1);
  mix-blend-mode: screen;
}

.chip {
  display: grid;
  place-items: center;
  width: 14%;
  aspect-ratio: 5/4;
  left: 10%;
  top: 30%;
  border-radius: 10% 10% 10% 10%/15% 15% 15% 15%;
  background-image: none, none, linear-gradient(120deg, #777 10%, #ddd 40%, #ddd 60%, #777 90%);
  background-size: 200% 200%;
  background-position: 50% 50%;
  overflow: hidden;
  -webkit-animation: bg var(--duration) ease infinite;
          animation: bg var(--duration) ease infinite;
}

.chip svg {
  display: block;
  width: 90%;
  fill: none;
  stroke: #444;
  stroke-width: 2;
}

.contactless {
  position: absolute;
  left: 23%;
  top: 30%;
  width: 12%;
  rotate: 90deg;
  stroke-width: 1.25;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
}

.icon {
  width: 25%;
  bottom: auto;
  right: auto;
  top: 0;
  left: 15px;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0