A Pen by Ward Penney on CodePen.
Created
October 3, 2014 20:56
-
-
Save wardpenney/e785dcc4cb6773836aad to your computer and use it in GitHub Desktop.
A Pen by Ward Penney.
This file contains hidden or 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
| .outer | |
| .clip | |
| - (1..40).each do |i| | |
| .plane{ class: "plane-#{i}" } | |
| .face{ class: "face-#{i}" } | |
| .stair-face |
This file contains hidden or 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
| $yo-color: lighten(#431B6B, 10%); | |
| $top-color: darken(#9DFE38, 30%); | |
| $steps: 20; | |
| $offset-x: 20em; | |
| $offset-y: -4em; | |
| @function stair-plane-top($i) { | |
| @return $offset-y + (2em * $i); | |
| } | |
| @function stair-plane-left($i) { | |
| @return $offset-x + (2em * $i); | |
| } | |
| @function stair-face-top($i) { | |
| @return $offset-y + -1.4em + (2em * $i); | |
| } | |
| @function stair-face-left($i) { | |
| @return $offset-x + 1.0em + (2em * $i); | |
| } | |
| @mixin keyframes-stairs-plane($i) { | |
| @-webkit-keyframes stairs-plane-#{$i} { | |
| 0% { | |
| top: stair-plane-top($i - 1); | |
| left: stair-plane-left($i - 1); | |
| background-color: lighten($yo-color, ($i - 1) * 4%); | |
| } | |
| 100% { | |
| top: stair-plane-top($i); | |
| left: stair-plane-left($i); | |
| background-color: lighten($yo-color, $i * 4%); | |
| } | |
| }; | |
| } | |
| @mixin keyframes-stairs-face($i) { | |
| @-webkit-keyframes stairs-face-#{$i} { | |
| 0% { | |
| top: stair-face-top($i - 1); | |
| left: stair-face-left($i - 1); | |
| background-color: lighten($top-color, ($i - 1) * 4%); | |
| } | |
| 100% { | |
| top: stair-face-top($i); | |
| left: stair-face-left($i); | |
| background-color: lighten($top-color, $i * 4%); | |
| } | |
| }; | |
| } | |
| @for $i from 1 through $steps { | |
| @include keyframes-stairs-plane($i); | |
| @include keyframes-stairs-face($i); | |
| .plane-#{$i} { | |
| background-color: lighten($yo-color, $i * 4%); | |
| top: stair-plane-top($i); | |
| left: stair-plane-left($i); | |
| transform: skewY(-25deg); | |
| -webkit-animation: stairs-plane-#{$i} 1s linear 0s infinite; | |
| } | |
| .face-#{$i} { | |
| background-color: lighten($top-color, $i * 4%); | |
| top: stair-face-top($i); | |
| left: stair-face-left($i); | |
| transform: skewX(-65deg); | |
| -webkit-animation: stairs-face-#{$i} 1s linear 0s infinite; | |
| } | |
| } | |
| .outer { | |
| position: relative; | |
| } | |
| .clip { | |
| overflow: hidden; | |
| top: $offset-y + .6em; | |
| left: $offset-x; | |
| height: 12.8em; | |
| width: 16em; | |
| } | |
| .stair-face { | |
| position: absolute; | |
| top: $offset-y + .6em; | |
| left: $offset-x; | |
| height: 12.8em; | |
| width: 16em; | |
| } | |
| .plane { | |
| width: 6em; | |
| height: 2em; | |
| display: inline-block; | |
| position: absolute; | |
| } | |
| .face { | |
| width: 2em; | |
| height: 2.8em; | |
| display: inline-block; | |
| position: absolute; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment