$base-color: #bada55; $tiles: 13; $tiles-per-row: 5; $rows: ceil($tiles / $tiles-per-row); .tiles { @extend .cf; position: relative; top: 0; height: 0; padding-bottom: #{100 / $tiles + '%'}; transition: all 0.3s ease-in-out 1s; .tile { position: absolute; top: 0; width: #{100 / $tiles + '%'}; height: 0; padding-bottom: #{100 / $tiles + '%'}; background: darken($base-color, 10%); overflow: hidden; @for $i from 1 to ($tiles + 1) { &:nth-child(#{$i}) { $color: 128 / $i; left: #{($i - 1) * (100 / $tiles) + '%'}; background: rgb($color, $color, $color); transition: all 0.3s ease-in-out #{(($i - 1) * 10 / $tiles) / 10 + 's'}; } } } &.big { padding-bottom: #{(100 / $tiles-per-row) * $rows + '%'}; transition: all 0.3s ease-in-out; & .tile { width: #{100 / $tiles-per-row + '%'}; padding-bottom: #{100 / $tiles-per-row + '%'}; @for $i from 1 to ($tiles + 1) { &:nth-child(#{$i}) { $row: ceil($i / $tiles-per-row); left: #{($i - 1 - (($row - 1) * $tiles-per-row)) * (100 / $tiles-per-row) + '%'}; top: #{($row - 1) * 100 / ($rows) + '%'}; transition: all 0.3s ease-in-out #{(10 - $i * 10 / $tiles) / 10 + 's'}; } } } } } .content { position: relative; } .video-wrapper { position: relative; width: 100%; height: 0; padding-bottom: 56.25%; overflow: hidden; transition: padding-bottom 1s ease-in-out; .hide-video & { padding-bottom: 0; } .video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: lighten($base-color, 10%); } } .play-button { position: absolute; top: 50%; left: 50%; width: 3em; border: 0.125em solid currentColor; border-radius: 5em; font-size: 3em; line-height: 2.75; color: lighten($base-color, 25%); text-align: center; transform: translate(-50%, -50%); } /** GLOBAL STYLES **/ @import url(http://fonts.lug.ustc.edu.cn/css?family=Open+Sans:300|Oswald:400,700,300); * { box-sizing: border-box; } html, body { width: 100%; height: 100%; } html { font-size: 62.5%; } body { background: $base-color; font-family: 'Open Sans', sans-serif; font-size: 2em; line-height: 1.5; color: white; -webkit-transform:rotateY(0deg); } body > p { width: 50%; margin: 0 auto; text-align: center; } h1 { font-family: 'Oswald', sans-serif; font-weight: 400; text-align: center; text-transform: uppercase; } h3 { font-family: 'Oswald'; font-weight: 400; text-transform: uppercase; text-align: center; } .container { width: 100%; margin: 1.5em auto; } a { color: white; } .cf:before, .cf:after { content: " "; display: table; } .cf:after { clear: both; } .cf { *zoom: 1; }