div+css实现下雨动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现下雨动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> *, *::before, *::after { padding: 0; margin: 0 auto; box-sizing: border-box; } body { background-color: #222; color: #fff; min-height: 100vh; display: grid; place-items: center; perspective: 1200px; } body *:not(:empty) { transform-style: preserve-3d; } .scene { position: relative; } .drop { position: absolute; left: 0; bottom: -25vh; width: 1px; height: 100vh; transform: translate3d(var(--tx, 0), 0, var(--tz, 0)); transform-style: preserve-3d; background-image: linear-gradient(transparent 95vh, #def3); -webkit-animation: drop 12s var(--delay, 0s) ease-in infinite; animation: drop 12s var(--delay, 0s) ease-in infinite; } @-webkit-keyframes drop { 0%, 75% { background-position-y: 5vh; } 100% { background-position-y: 105vh; } } @keyframes drop { 0%, 75% { background-position-y: 5vh; } 100% { background-position-y: 105vh; } } .drop:nth-child(1) { --delay: 0s; --tx: 9vmin; --tz: 21.75vmin; } .drop:nth-child(2) { --delay: -0.25s; --tx: -24vmin; --tz: 7.5vmin; } .drop:nth-child(3) { --delay: -0.5s; --tx: -24.5vmin; --tz: -15.75vmin; } .drop:nth-child(4) { --delay: -0.75s; --tx: -1.........完整代码请登录后点击上方下载按钮下载查看
网友评论0