//some night-like colors $navy: #030327; $cheese: #fffdd0; $dark_cheese: #f0edb4; $white: #fff; $night_sky: $navy; $star_color: $white; $crater_shadow: #d0cd8a; //$crater_glow: #fffee1; $moon_color: $cheese; $crater_color: $dark_cheese; //some dimensions and stuff $moon_width: 12em; $moon_height: 12em; $day_sky: rgba(93, 214, 240, 1); //some mixins @mixin centerer { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } @mixin cf { &:after { content: ""; display: table; clear: both; } } @mixin shadow($h, $v, $b, $s, $c) { -webkit-box-shadow: $h $v $b $s $c; -moz-box-shadow: $h $v $b $s $c; box-shadow: $h $v $b $s $c; } @mixin circlizer($r) { -webkit-border-top-left-radius: $r; -webkit-border-top-right-radius: $r; -webkit-border-bottom-right-radius: $r; -webkit-border-bottom-left-radius: $r; -moz-border-radius-topleft: $r; -moz-border-radius-topright: $r; -moz-border-radius-bottomright: $r; -moz-border-radius-bottomleft: $r; border-top-left-radius: $r; border-top-right-radius: $r; border-bottom-right-radius: $r; border-bottom-left-radius: $r; } //a function @function star_positioner() { @return random(1920) + px; } //some elements html, body { width: 100%; height: 100%; } .sky { position: relative; width: 100%; height: 100%; background: $night_sky; overflow: hidden; -webkit-animation: its_becoming_morning 6s linear; -webkit-animation-fill-mode: forwards; -webkit-animation-delay: 3s; } .star { position: absolute; background: rgba(255, 253, 208, .8); @include shadow(0, 0, .1em, .1em, rgba(255, 253, 208, .2)); @for $s from 1 through 400 { $star_size: (random(2) / 10) + em; &:nth-child(#{$s}) { $vanishing_speed: random(20) + s; -webkit-animation: cya_stars $vanishing_speed ease; -webkit-animation-fill-mode: forwards; -webkit-animation-delay: random(5) + s; width: $star_size; height: $star_size; @include circlizer($star_size); top: star_positioner(); left: star_positioner(); } } //$vanishing_speed: random(40) + s; //-webkit-animation: cya_stars $vanishing_speed ease; //-webkit-animation-fill-mode: forwards; //-webkit-animation-delay: 6s; } .moon { @include centerer; z-index: 10; -webkit-animation: set_rise 7s ease-in-out; -webkit-animation-fill-mode: forwards; } .moon-pos { -webkit-animation: shine_on 10s ease; //13 -webkit-animation-fill-mode: forwards; position: relative; z-index: 20; width: $moon_width; height: $moon_height; @include circlizer($moon_width); background: $moon_color; overflow: hidden; } .crater { -webkit-animation: poof 2s linear; -webkit-animation-delay: 3s; -webkit-animation-fill-mode: forwards; position: absolute; z-index: 30; background: $crater_color; @include shadow(inset, 0, 0, 1em, $crater_shadow); &:nth-child(1) { width: $moon_width - 11; height: $moon_height - 11; top: 4em; left: 2em; @include circlizer(1em); } &:nth-child(2) { width: $moon_width - 10; height: $moon_width - 10; top: 2em; left: 2em; @include circlizer(2em); } &:nth-child(3) { width: $moon_width - 9; height: $moon_width - 9; bottom: 1em; @include circlizer(3em); } &:nth-child(4) { width: $moon_width - 9; height: $moon_width - 9; bottom: 2em; right: 2em; @include circlizer(3em); } &:nth-child(5) { width: $moon_width - 10.5; height: $moon_height - 10.5; right: 6em; bottom: .5em; @include circlizer(1.5em); } } .moon-neg { position: absolute; z-index: 40; top: 0; right: 0; width: $moon_width - 3em; height: $moon_height - 3em; @include circlizer($moon_width - 3em); background: $night_sky; -webkit-animation: poof 1s linear; -webkit-animation-fill-mode: forwards; -webkit-animation-delay: 3s; } .tag { color: $cheese; font-family: 'Seaweed Script'; font-size: 6em; } //animation @-webkit-keyframes cya_stars { 100% { -webkit-transform: translateY(1080px); opacity: 0; transition: opacity; } } @-webkit-keyframes its_becoming_morning { 100% { background: $day_sky; -webkit-transition: background; -webkit-transition-timing-function: ease-out; } } @-webkit-keyframes poof { 100% { background: orange; height: 0; width: 0; opacity: 0; top: 50%; -webkit-transition: opacity; -webkit-transition: width; -webkit-transition: height; -webkit-transition: top; -webkit-transition: background; -webkit-transition-timing-function: ease-out; } } @-webkit-keyframes shine_on { 100% { background: orange; -webkit-transition: background; -webkit-box-shadow: 0 0 6em 1em rgba(243, 229, 70, .8); } } @-webkit-keyframes set_rise { 30% { -webkit-transform: translateY(500px); } }