Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <style type="text/css">
- /*slide in out version, note that that 50px should be replaced with the height of the tallest raindrop.*/
- /*
- @-webkit-keyframes fall {
- from
- {
- top: calc(100% + -50px);
- }
- to
- {
- top: calc(100% + 50px);
- }
- }
- @keyframes fall {
- from
- {
- top:0%;
- }
- to
- {
- top: 100%;
- }
- }
- .curtainWrapper
- {
- overflow-y:hidden;
- }
- */
- /*bead & splash version*/
- @-webkit-keyframes fall {
- 0%
- {
- top:0%;
- -webkit-transform-origin: 50% 0%;
- transform-origin: 50% 0%;
- -webkit-transform:scale(0,0);
- transform:scale(0,0);
- }
- 10%
- {
- top:0%;
- -webkit-transform-origin: 50% 0%;
- transform-origin: 50% 0%;
- -webkit-transform:scale(1,1);
- transform:scale(1,1);
- }
- 95%
- {
- top: 100%;
- -webkit-transform-origin: 50% 100%;
- transform-origin: 50% 100%;
- -webkit-transform:scale(1,1);
- transform:scale(1,1);
- }
- 100%
- {
- top: 100%;
- -webkit-transform-origin: 50% 100%;
- transform-origin: 50% 100%;
- -webkit-transform:scale(2,0);
- transform:scale(2,0);
- }
- }
- @keyframes fall {
- 0%
- {
- top: calc(0%);
- -webkit-transform-origin: 50% 0%;
- transform-origin: 50% 0%;
- -webkit-transform:scale(0,0);
- transform:scale(0,0);
- }
- 10%
- {
- top: calc(0%);
- -webkit-transform-origin: 50% 0%;
- transform-origin: 50% 0%;
- -webkit-transform:scale(1,1);
- transform:scale(1,1);
- }
- 97.5%
- {
- top: calc(100% - 50px);
- -webkit-transform-origin: 50% 100%;
- transform-origin: 50% 100%;
- -webkit-transform:scale(1,1);
- transform:scale(1,1);
- }
- 100%
- {
- top: calc(100% - 50px);
- -webkit-transform-origin: 50% 100%;
- transform-origin: 50% 100%;
- -webkit-transform:scale(1.5,0);
- transform:scale(2,0);
- }
- }
- /* stuff for both versions */
- .rainCurtain
- {
- height: 100%;
- }
- /*matches all direct children of "rainCurtain", which should theoretically be rain drops.*/
- .rainCurtain > *
- {
- display: inline-block;
- /*relative instead of absolute to preserve natural horizontal positioning*/
- position: relative;
- /*remember to use both -webkit- and the standard syntax. http://caniuse.com/#feat=css-animation shows what "vendor prefixes" are still neccessary.*/
- -webkit-animation-name: fall;
- animation-name: fall;
- -webkit-animation-iteration-count:infinite;
- animation-iteration-count:infinite;
- /*you can adjust this to affect the overall speed*/
- -webkit-animation-duration: 5s;
- animation-duration: 5s;
- /*an attempt to make them seem like they initially cling to the top then increase velocity as they fall, reaching terminal velocity fairly quickly*/
- animation-timing-function: ease-in;
- animation-timing-function: ease-in;
- }
- /*the rest of this below are just sample customisations to set the drops apart, other demo stuff etc*/
- body
- {
- margin:0px;
- padding: 0px;
- }
- .curtainWrapper
- {
- height: 100%;
- height: 100vh;
- }
- .rainCurtain
- {
- display: -webkit-flex;
- display: flex;
- -webkit-flex-direction:row;
- flex-direction:row;
- -webkit-flex-wrap:nowrap;
- flex-wrap:nowrap;
- -webkit-justify-content:space-around;
- justify-content:space-around;
- -webkit-flex: 0 0 auto;
- flex: 0 0 auto;
- }
- .rainCurtain > *
- {
- width: 50px;
- height:50px;
- background-color: black;
- }
- .rainCurtain > :nth-child(2n)
- {
- /*set this differently for different raindrops to make them move seperately, you can also adjust duration and timing-function for different drops as well if you wish. defaults to 0*/
- -webkit-animation-delay:1s;
- animation-delay:1s;
- }
- .rainCurtain > :nth-child(3n+1)
- {
- /*where this overlaps with 2n it will override as it comes last in the ruleset*/
- -webkit-animation-delay:1.8s;
- animation-delay:1.8s;
- }
- </style>
- </head>
- <body>
- <div class="curtainWrapper">
- <div class="rainCurtain">
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement