Welcome to mirror list, hosted at ThFree Co, Russian Federation.

_parallax.scss « src - github.com/picturepan2/spectre.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 00897bff9fc6df58f4917738f1cd483c8d281838 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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 {
    height: auto;
    @include shadow-variant(1rem);
    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, 0.35) 0%, rgba(255, 255, 255, 0) 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, 0.35) 0%, rgba(255, 255, 255, 0) 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, 0.35) 0%, rgba(255, 255, 255, 0) 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, 0.35) 0%, rgba(255, 255, 255, 0) 50%);
      }

      .parallax-front {
        transform: translate3d(-$parallax-offset, -$parallax-offset, $parallax-offset-z) scale($parallax-scale);
      }
    }
  }
}