Randomize all the things. Inspired by @mknadler's SassConf talk.
Created
May 7, 2016 20:51
-
-
Save Frankie-666/009bde2fa34fd1fa3d286f0a4ae741d2 to your computer and use it in GitHub Desktop.
Random animated pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- i = 0 | |
while i < 50 | |
div | |
- i++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background: rgb(5,5,15); | |
overflow: hidden; | |
} | |
div { | |
border-radius: 50%; | |
position: absolute; | |
top: 0; | |
left: 0; | |
transform-origin: 0 0; | |
} | |
@for $n from 0 through 50 { | |
$size: random(1,40); | |
$hue: random(180,360); | |
div:nth-child(#{$n}) { | |
animation: anim-#{$n} random(15,50)+s infinite alternate random(0,10)/10 + s; | |
background: radial-gradient( | |
hsl($hue,95,65), | |
hsl($hue + 60,95,65) 49%, | |
transparent 51% | |
); | |
border: 2px solid hsl($hue,80,85); | |
transform: translate3d(random(100) + vw, random(100) + vh, 0); | |
opacity: random(10)/10; | |
width: $size + px; | |
height: $size + px; | |
} | |
@keyframes anim-#{$n} { | |
33% { | |
transform: translate3d(random(100) + vw,random(100) + vh, 0); | |
opacity: 0; | |
} | |
66% { | |
transform: translate3d(random(100) + vw,random(100) + vh, 0); | |
} | |
100% { | |
transform: translate3d(random(100) + vw,random(100) + vh, 0); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment