纯css实现窗外风雨交加动画效果
代码语言:html
所属分类:动画
代码描述:纯css实现窗外风雨交加动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> :root { --size: 45vmin; --pull: 1vmin; --height-sill: calc(var(--size) / 4); --height-ac: calc(var(--size) / 2.75); --height-curtain-rod: calc(var(--size) / 40); --color-wall: hsl(8, 72%, 72%); --color-frame: hsl(0, 100%, 100%); --color-ac-unit: hsl(72, 2%, 97%); --color-ac-unit-inner: hsl(0, 0%, 70%); --color-outside: hsl(213, 74%, 40%); --color-curtain-rod: hsl(18, 80%, 10%); --color-book-1: hsl(55, 100%, 48%); --color-book-2: hsl(178, 93%, 21%); --color-book-3: hsl(194, 100%, 48%); --color-planter: hsl(0, 100%, 100%); --color-leaf: hsl(72, 40%, 43%); --border-frame: 2.5vmin; --border-radius: 0.25vmin; } * { box-sizing: border-box; } html, body { height: 100%; } body { display: grid; place-items: center; background-color: var(--color-wall); } .frame { display: grid; position: relative; margin-top: calc(var(--height-sill) * -1); width: var(--size); height: calc(var(--size) * 1.5); border-radius: var(--border-radius) var(--border-radius) 0 0; background-color: var(--color-frame); } .outside { position: absolute; width: 100%; height: 100%; background-color: var(--color-outside); overflow: hidden; -webkit-animation: flash 10s linear infinite; animation: flash 10s linear infinite; } .rain { position: absolute; left: 0; top: 0; width: 100%; height: 100%; -webkit-transform: rotate(25deg); transform: rotate(25deg); } .drop { position: absolute; background-color: rgba(255, 255, 255, 0.3); width: 1px; height: 4vmin; -webkit-animation: fall 200ms linear infinite; animation: fall 200ms linear infinite; } .drop:nth-child(1) { top: 92%; left: 48%; -webkit-animation-delay: -0.03s; animation-delay: -0.03s; -webkit-animation-duration: 203ms; animation-duration: 203ms; } .drop:nth-child(2) { top: 82%; left: 98%; -webkit-animation-delay: -0.06s; animation-delay: -0.06s; -webkit-animation-duration: 207ms; animation-duration: 207ms; } .drop:nth-child(3) { top: 32%; left: 26%; -webkit-animation-delay: -0.09s; animation-delay: -0.09s; -webkit-animation-duration: 201ms; animation-duration: 201ms; } .drop:nth-child(4) { top: 12%; left: 64%; -webkit-animation-delay: -0.12s; animation-delay: -0.12s; -webkit-animation-duration: 207ms; animation-duration: 207ms; } .drop:nth-child(5) { top: 92%; left: 66%; -webkit-animation-delay: -0.15s; animation-delay: -0.15s; -webkit-animation-duration: 202ms; animation-duration: 202ms; } .drop:nth-child(6) { top: 82%; left: 38%; -webkit-animation-delay: -0.18s; animation-delay: -0.18s; -webkit-animation-duration: 204ms; animation-duration: 204ms; } .drop:nth-child(7) { top: 58%; left: 92%; -webkit-animation-delay: -0.21s; animation-delay: -0.21s; -webkit-animation-duration: 201ms; animation-duration: 201ms; } .drop:nth-child(8) { top: 62%; left: 28%; -webkit-animatio.........完整代码请登录后点击上方下载按钮下载查看
网友评论0