Skip to content

Instantly share code, notes, and snippets.

@Gottox
Created December 3, 2014 22:47
Show Gist options
  • Save Gottox/9af1dc9d5b2f11b436a2 to your computer and use it in GitHub Desktop.
Save Gottox/9af1dc9d5b2f11b436a2 to your computer and use it in GitHub Desktop.
cat <<EOF
@keyframes flakeH {
from { left: 0%; }
to { left: 100%; }
}
@keyframes flakeV {
from { top: 0%; }
to { top: 100%; }
}
@-webkit-keyframes flakeH {
from { left: 0%; }
to { left: 100%; }
}
@-webkit-keyframes flakeV {
from { top: 0%; }
to { top: 100%; }
}
@-moz-keyframes flakeH {
from { left: 0%; }
to { left: 100%; }
}
@-moz-keyframes flakeV {
from { top: 0%; }
to { top: 100%; }
}
#snow i, #snow b {
font-style:normal;
font-weight:normal;
}
#snow i {
pointer-events: none;
animation: flakeV 0s linear 0s infinite; /* Chrome, Safari, Opera */
-webkit-animation: flakeV 0s linear 0s infinite; /* Chrome, Safari, Opera */
-moz-animation: flakeV 0s linear 0s infinite; /* Chrome, Safari, Opera */
position:fixed;
top:0;
}
#snow b {
position:absolute;
color: white;
text-shadow: 0px 0px 1px black;
animation: flakeH 0s ease-in-out 0s infinite alternate; /* Chrome, Safari, Opera */
-webkit-animation: flakeH 0s ease-in-out 0s infinite alternate; /* Chrome, Safari, Opera */
-moz-animation: flakeH 0s ease-in-out 0s infinite alternate; /* Chrome, Safari, Opera */
}
EOF
rand() {
r=`od -N1 -An -i /dev/urandom`
echo "$1 + $r%$2" | bc
}
rand2() {
r=`od -N1 -An -i /dev/urandom`
r2=`od -N1 -An -i /dev/urandom`
if [ $2 -eq 0 ]; then
echo "$1; $r2%(10^$3)" | bc | tr "\n" '.' | sed "s/\.$//"
else
echo "$1 + $r%$2; $r2%(10^$3)" | bc | tr "\n" '.' | sed "s/\.$//"
fi
}
for i in `seq 1 20`; do
left=`rand 0 100`
duration1=`rand2 20 20 1`
duration2=`rand2 1 5 2`
delay=`rand 0 20`
width=`rand 10 30`
size=`rand 6 6`
cat <<EOF
#snow i:nth-child($i) {
left:${left}%;
animation-duration:${duration1}s; -webkit-animation-duration:${duration1}s; -moz-animation-duration:${duration1}s;
animation-delay:${delay}s; -webkit-animation-delay:${delay}s; -moz-animation-delay:${delay}s;
width:${width}pt;
font-size:${size}pt;
}
#snow i:nth-child($i) b {
animation-duration:${duration2}s; -webkit-animation-duration:${duration2}s; -moz-animation-duration:${duration2}s;
}
EOF
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment