SCSS Waves
Some more practice
Based on https://31.media.tumblr.com/4ec19f57d3dc97418bdaab8ba25bae4d/tumblrn6sdwy3E3k1suvw3go21280.gif
.container
.container
- (1...12).each do |c|
.wave
$n:12; /* Make sure it's the same as the HAML */
$n:12; /* Make sure it's the same as the HAML */
$bgColor:#B9AF8B;
$waveColor:#229789;
$animLength: 8; /* In seconds */
$sunPercent:30%; /* Width / 2 & height of sun */
html,body { height:100%; margin:0; }
body { background-color:$bgColor; }
.container {
position: relative;
width: 100%;
height: 0;
background-image: linear-gradient(to bottom, transparent 50%, $bgColor 50%),
radial-gradient(ellipse at center, $waveColor 50%, $bgColor 50%);
padding-top: 100%;
overflow: hidden;
}
.wave {
background-color:$waveColor;
width:100%;
height:50% / $n;
position:absolute;
left:0;
perspective:400px;
transform-origin:top center;
}
$i from 1 to $n {
wave#{$i} {
0% { transform:scaleY(1.1 - (1 / $i)) rotateX(0); }
100% { transform:scaleY(1.1 - (1 / $i)) rotateX(360deg); }
}
.wave:nth-of-type(#{$i}) {
top:50% + (50% / $n * ($i - 1)) - .5%;
animation:wave#{$i} ($animLength + s) (- ($animLength / 8) * ($i / $n) + s) linear infinite;
}
}