纯css实现卡片三维汽车颠簸行驶动画效果
代码语言:html
所属分类:动画
代码描述:纯css实现卡片三维汽车颠簸行驶动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> body { background: #fff; height: 100vh; overflow: hidden; display: -webkit-box; display: flex; font-family: 'Anton', sans-serif; -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; -webkit-perspective: 1000px; perspective: 1000px; } div { position: absolute; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; background: linear-gradient(45deg, #a95b58 0%, #db8d8a 100%); box-sizing: border-box; will-change: transform; } .window { background: rgba(0, 100, 255, 0.3); } #truck { -webkit-animation: drive 10000ms linear infinite; animation: drive 10000ms linear infinite; } #truck .body { width: 100px; -webkit-transform: translate(200px, -100px) translateZ(100px); transform: translate(200px, -100px) translateZ(100px); } #truck .shadow { width: 160px; height: 210px; background: #aaaaaa; -webkit-transform-origin: 50% 100%; transform-origin: 50% 100%; -webkit-transform: translate(-30px, -130px) translateZ(20px) rotateX(90deg); transform: translate(-30px, -130px) translateZ(20px) rotateX(90deg); -webkit-filter: blur(0px); filter: blur(0px); box-shadow: 0 0 35px 25px white inset; -webkit-backface-visibility: hidden; backface-visibility: hidden; } #truck .cockpit { -webkit-animation: bounce 600ms ease-out infinite alternate; animation: bounce 600ms ease-out infinite alternate; } #truck .cockpit .front { width: 100px; height: 50px; } #truck .cockpit .back { width: 100px; height: 75px; -webkit-transform: translate(0, -50px) translateZ(-50px); transform: translate(0, -50px) translateZ(-50px); } #truck .cockpit .top { width: 100px; height: 25px; -webkit-transform-origin: 50% 100%; transform-origin: 50% 100%; -webkit-transform: translate(0, -75px) translateZ(-25px) rotateX(90deg); .........完整代码请登录后点击上方下载按钮下载查看
网友评论0