纯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-animation: backdrop calc(var(--speed) * 1s) calc(var(--delay) * -1s) infinite linear both; animation: backdrop calc(var(--speed) * 1s) calc(var(--delay) * -1s) infinite linear both; } .truck { position: relative; width: calc(var(--width) * 1px); height: calc(var(--width) * 0.33px); } .truck:after { content: ''; height: 5%; width: 100%; background: #000; position: absolute; left: 0; bottom: 5%; border-radius: 100%; -webkit-filter: blur(10px); filter: blur(10px); } .truck__indicator { height: 2%; width: 3%; position: absolute; right: 1.5%; background: #915d08; top: 64%; opacity: 0.45; z-index: 10; } .truck__foglight { height: 2%; width: 1%; position: absolute; left: 2%; background: #911308; top: 58%; opacity: 0.45; z-index: 10; } .truck__taillight { height: 2%; width: 1%; background: radial-gradient(circle at center, #ffebeb, #f00), #f00; box-shadow: 0 0 30px 5px #f33; position: absolute; top: 25%; z-index: 10; left: 0; } .truck__taillight:after { content: ''; height: 100%; width: 800%; background: #ff4d4d; position: absolute; right: 0; top: 0; border-ra.........完整代码请登录后点击上方下载按钮下载查看
网友评论0