css实现落日傍晚汽车在马上上飞驰行驶动画效果代码
代码语言:html
所属分类:动画
代码描述:css实现落日傍晚汽车在马上上飞驰行驶动画效果代码
代码标签: css 汽车 傍晚 落日 飞驰 行驶 马路 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> :root { --car-color: #ff2800; --window-color: #add8e6; --success-color: #2eff04; --error-color: #fd1c03; } html { background-color: #000; background-image: radial-gradient(ellipse at center, rgba(127, 0, 173, 0.4) 0%, black 90%); height: 100%; } *, *:after, *:before { box-sizing: border-box; } .wrapper { background-color: #000; background-image: radial-gradient(ellipse at center, rgba(127, 0, 173, 0.6) 0%, rgba(0, 0, 0, 0.8) 60%, black 90%); background-size: cover; border: 1px solid rgba(127, 0, 173, 0.6); box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.22); height: 600px; width: 800px; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); position: absolute; overflow: hidden; -webkit-perspective: 50px; perspective: 50px; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .sun { position: absolute; border-radius: 50%; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); width: 12.5em; height: 12.5em; background: -webkit-gradient(linear, left top, left bottom, from(#f12711), to(yellow)); background: linear-gradient(#f12711, yellow); box-shadow: 0 0 30px #f5af19; } .grid { background: #010101; height: 60em; -webkit-transform: scale(1.4) rotateX(90deg); transform: scale(1.4) rotateX(90deg); position: absolute; width: 600%; margin-left: -250%; } .grid::after { -webkit-animation: 2.4s dash linear infinite; animation: 2.4s dash linear infinite; background-image: linear-gradient(180deg, rgba(0, 0, 0, 0) 0px, rgba(54, 226, 248, 0.25) 0%, rgba(54, 226, 248, 0.25) 3px, rgba(0, 0, 0, 0) 0px), linear-gradient(90deg, rgba(0, 0, 0, 0) 0px, rgba(54, 226, 248, 0.5) 0%, rgba(54, 226, 248, 0.5) 3px, rgba(0, 0, 0, 0) 0px); background-size: 60px 60px, 60px 60px; background-color: rgba(2, 40, 45, 0.5); content: ""; width: 10%; height: 100%; position: absolute; bottom: 0; left: 50%; border: 2px solid rgba(54, 226, 248, 0.25); -webkit-transform: translateX(-50%); transform: translateX(-50%); } .car { -webkit-animation: 3s sway ease-in-out infinite; animation: 3s sway ease-in-out infinite; height: 180px; left: 50%; -webkit-perspective: 200px; perspective: 200px; position: absolute; width: 240px; top: 55.5%; margin-left: -120px; z-index: 2; } .car::before { -webkit-animation: 3s skew ease-in-out infinite; animation: 3s skew ease-in-out infinite; content: ""; width: 110%; height: 100%; background: rgba(0, 0, 0, 0.6); position: absolute; top: 75%; left: 50%; -webkit-transform: rotateX(60deg) translateX(-50%); transform: rotateX(60deg) translateX(-50%); z-index: 0; } .car__bumper { border-radius: 10em 10em 8em 8em; background: #111; position: absolute; bottom: 10%; height: 35%; overflow: hidden; width: 90%; left: 5%; } .car__bumper::after { background: rgba(255, 255, 255, 0.05); height: 20%; content: ""; position: absolute; bottom: 0; left: 0; width: 100%; } .car__back { border-radius: 8em 8em 4em 4em; background: var(--car-color); position: absolute; bottom: 25%; height: 35%; overflow: hidden; width: 95%; left: 2.5%; } .car__back::after { background: rgba(0, 0, 0, 0.2); height: 30%; content: ""; position: absolute; bottom: 0; left: 0; width: 100%; } .car__back:before { background: rgba(255, 255, 255, 0.2); border-radius: 1em; position: absolute; content: ""; height: 10%; top: 5%; left: 50%; width: 60%; -webkit-transform: translateX(-50%); transform: translateX(-50%); } .car__light { background-color: red; background-position: -2px -2px, -8px -8px; background-image: radial-gradient(white 10%, transparent 11%), radial-gradient(white 10%, transparent 11%); border-radius: 50%; border: 0.1em solid #8b0000; box-shadow: inset 0 0 0 0.3em rgba(255, 165, 0, 0.8), 0 0 0.3em rgba(255, 0, 0, 0.8), 0 0 6px 3px #fb492b inset, 0 0 15px 1px #fb492b; padding-top: 14%; width: 15%; position: absolute; -webkit-transform: translateY(-50%); transform: translateY(-50%); top: 50%; z-index: 2; } .car__light--small { background: white; padding-top: 9.5%; top: 65%; width: 11%; z-index: 3; } .car__light--left { left: 5%; } .car__light--small.car__light--left { left: 15%; } .car__light--right { right: 5%; } .car__light--small.car__light--right { right: 15%; } .car__plate { border-radius: 0.2em; border: 0.1em solid #333; box-shadow: 0 4px 2px -2px rgba(0, 0, 0, 0.6); height: 12.5%; font-weight: bold; font-size: 12px; letter-spacing: 0.01em; position: absolute; background: yellow; text-align: center; left: 50%; bottom: 15%; padding: 2% 0; -webkit-transform: translateX(-50%); transform: translateX(-50%); width: 28%; } .car__roof { border-radius: 1em 1em 0 0; background-color: var(--car-color); background-image: -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(70%, rgba(0, 0, 0, 0.5))); background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.5) 70%); bottom: 45%; left: 50%; width: 60%; height: 45%; position: absolute; -webkit-transform: rotateX(50deg) translateX(-50%); transform: rotateX(50deg) translateX(-50%); } .car__roof:after { background: var(--window-color); border-radius: 1em 1em 0 0; position: absolute; content: ""; height: 70%; bottom: 5%; left: 50%; width: 80%; -webkit-transform: translateX(-50%); transform: translateX(-50%); } .car__roof:before { background: rgba(255, 255, 255, 0.4); border-radius: 1em; position: absolute; content: ""; height: 10%; top: 5%; left: 50%; width: 80%; -webkit-transform: translateX(-50%); transform: translateX(-50%); } .car__grill { background-color: #222; background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.1em, #111), color-stop(0.1em, transparent)); background-image: linear-gradient(#111 0.1em, transparent 0.1em); background-size: 100% 0.2em; border-radius: 0.5em; position: absolute; height: 50%; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); width: 80%; z-index: 1; } .car__emblem { border: 1px solid white; height: 0.85em; width: 0.85em; position: absolute; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%) rotate(45deg); transform: translate(-50%, -50%) rotate(45deg); } .car__emblem::after { content: ""; position: absolute; width: 0.3em; height: 0.3em; background: white; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } .car__wheel { -webkit-animation: wheels 3s ease-in-out infinite; animation: wheels 3s ease-in-out infinite; border-radius: 0.4em; position: absolute; height: 30%; bottom: 0; background: #010101; width: 22%; } .car__wheel::after, .car__wheel::before { animation: 1s dash linear infinite reverse; width: 10%; height: 100%; content: ""; position: absolute; background-color: rgba(255, 255, 255, 0.025); background-image: linear-gradient(180deg, rgba(0, 0, 0, 0) 0px, rgba(255, 255, 255, 0.025) 0%, rgba(255, 255, 255, 0.025) 2px, rgba(0, 0, 0, 0) 0px); background-size: 4px 6px; top: 0; } .car__wheel::after { left: 10%; } .car__wheel::before { right: 10%; } .car__wheel--left { -webkit-animation-delay: -1.5s; animation-delay: -1.5s; left: 2.5%; } .car__wheel--right { right: 2.5%; } .car__mirror { border-radius: 0.3em; position: absolute; top: 30%; background: var(--car-color); width: 1.5em; height: 1em; } .car__mirror::after { border-radius: 0.1em; content: ""; position: absolute; left: 0.1em; right: 0.1em; top: 0.1em; bottom: 0.1em; background: var(--window-color); } .car__mirror::before { background-color: inherit; background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.1)), to(rgba(0, 0, 0, 0.2))); background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.2)); content: ""; width: 2em; height: 0.5em; top: 90%; left: 80%; position: absolute; -webkit-transform: rotate(30deg); transform: rotate(30deg); z-index: 0; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0