纯css实现跑车运动动画效果

代码语言:html

所属分类:动画

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<title> Pure CSS CYBRTRK 🚙</title>
<link href="https://fonts.googleapis.com/css?family=Wallpoet&display=swap" rel="stylesheet">

<style>
  * {
  box-sizing: border-box;
}
.truck * {
  transition: all 0.25s ease;
}
body {
  align-items: center;
  background: linear-gradient(180deg, #1a1c23, #111317 50%, #1a1a1a 50%), #1a1a1a;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  width: 100vw;
}
:root {
  --width: 300;
}
@media (min-width: 768px) {
  :root {
    --width: 600;
  }
}
.title {
  display: none;
  --color: #b3b3b3;
  --speed: 0.1;
  text-transform: uppercase;
  color: var(--color);
  text-shadow: 0 0 20px var(--color);
  font-size: 25vh;
  font-family: 'Wallpoet', cursive;
  position: absolute;
  bottom: 42%;
  left: 50%;
  -webkit-transform: translate(-50%, 0);
          transform: translate(-50%, 0);
}
.title span {
  -webkit-animation: flicker calc(var(--speed, 4) * 1s) calc(var(--delay, 0) * 1s) infinite steps(1);
          animation: flicker calc(var(--speed, 4) * 1s) calc(var(--delay, 0) * 1s) infinite steps(1);
  opacity: var(--opacity, 1);
  --speed: calc(var(--index) + 1);
  --delay: var(--index);
}
@-webkit-keyframes flicker {
  0%, 20% {
    --opacity: 0.25;
  }
  10%, 30%, 40%, 70%, 80%, 90%, 100% {
    --opacity: 1;
  }
}
@keyframes flicker {
  0%, 20% {
    --opacity: 0.25;
  }
  10%, 30%, 40%, 70%, 80%, 90%, 100% {
    --opacity: 1;
  }
}
.mountain {
  height: calc(var(--height) * 1vh);
  width: calc(var(--width) * 1vw);
  position: absolute;
  bottom: 50%;
  background: hsl(35, 0%, calc(var(--lightness) * 1%));
  left: 50%;
  -webkit-animati.........完整代码请登录后点击上方下载按钮下载查看

网友评论0