diff options
| Commit | c811cb46631e66772a108c393f6ef53a83ca010b (patch) | |
|---|---|---|
| Author | 2017-09-01 15:34:29 +0800 | |
| Committer | 2017-09-01 15:34:29 +0800 | |
| Files | cc78dfa6f7398e9e77dd81d8865bcca939b9549d /src/_parallax.scss | |
| Spectre-Dark-Gruvbox-0.4.0.tar Spectre-Dark-Gruvbox-0.4.0.tar.gz Spectre-Dark-Gruvbox-0.4.0.zip | ||
| Parent | 66c492fd05c2d720c81e2be8d6845560b868e7ff (diff) | |
| Parent | cca094ecbf55e8a4f552e55219b37373d3c07d9e (diff) | |
Merge pull request #266 from picturepan2/0.4.0 v0.4.0
0.4.0
1 files changed, 129 insertions, 0 deletions
| -rw-r--r-- | src/_parallax.scss | 129 |
diff --git a/src/_parallax.scss b/src/_parallax.scss new file mode 100644 index 0000000..fcde262 --- /dev/null +++ b/src/_parallax.scss @@ -0,0 +1,129 @@ +// Parallax +$parallax-deg: 3deg; +$parallax-offset: 4.5px; +$parallax-offset-z: 50px; +$parallax-perspective: 1000px; +$parallax-scale: .95; + +// Mixin: Parallax direction +@mixin parallax-dir() { + height: 50%; + position: absolute; + width: 50%; + z-index: $zindex-1; +} + +.parallax { + display: block; + height: auto; + position: relative; + width: auto; + + .parallax-content { + @include shadow-variant(1rem); + height: auto; + transform: perspective($parallax-perspective); + transform-style: preserve-3d; + transition: all .4s ease; + width: 100%; + + &::before { + content: ""; + display: block; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; + } + } + + .parallax-front { + align-items: center; + color: $light-color; + display: flex; + height: 100%; + justify-content: center; + left: 0; + position: absolute; + text-align: center; + text-shadow: 0 0 20px rgba($dark-color, .75); + top: 0; + transform: translateZ($parallax-offset-z) scale($parallax-scale); + transition: all .4s ease; + width: 100%; + z-index: $zindex-0; + } + + .parallax-top-left { + @include parallax-dir(); + left: 0; + top: 0; + + &:hover ~ .parallax-content { + transform: perspective($parallax-perspective) rotateX($parallax-deg) rotateY(-$parallax-deg); + + &::before { + background: linear-gradient(135deg, rgba(255, 255, 255, .35) 0%, transparent 50%); + } + + .parallax-front { + transform: translate3d($parallax-offset, $parallax-offset, $parallax-offset-z) scale($parallax-scale); + } + } + } + + .parallax-top-right { + @include parallax-dir(); + right: 0; + top: 0; + + &:hover ~ .parallax-content { + transform: perspective($parallax-perspective) rotateX($parallax-deg) rotateY($parallax-deg); + + &::before { + background: linear-gradient(-135deg, rgba(255, 255, 255, .35) 0%, transparent 50%); + } + + .parallax-front { + transform: translate3d(-$parallax-offset, $parallax-offset, $parallax-offset-z) scale($parallax-scale); + } + } + } + + .parallax-bottom-left { + @include parallax-dir(); + bottom: 0; + left: 0; + + &:hover ~ .parallax-content { + transform: perspective($parallax-perspective) rotateX(-$parallax-deg) rotateY(-$parallax-deg); + + &::before { + background: linear-gradient(45deg, rgba(255, 255, 255, .35) 0%, transparent 50%); + } + + .parallax-front { + transform: translate3d($parallax-offset, -$parallax-offset, $parallax-offset-z) scale($parallax-scale); + } + } + } + + .parallax-bottom-right { + @include parallax-dir(); + bottom: 0; + right: 0; + + &:hover ~ .parallax-content { + transform: perspective($parallax-perspective) rotateX(-$parallax-deg) rotateY($parallax-deg); + + &::before { + background: linear-gradient(-45deg, rgba(255, 255, 255, .35) 0%, transparent 50%); + } + + .parallax-front { + transform: translate3d(-$parallax-offset, -$parallax-offset, $parallax-offset-z) scale($parallax-scale); + } + } + } +} |