-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparallax.less
116 lines (105 loc) · 2.29 KB
/
parallax.less
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
@perspective-default: 100px;
.scale(@z-value; @perspective) {
@scale: unit((@perspective - @z-value) / @perspective);
}
.parallax-variant(@perspective: @perspective-default) {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow-x: hidden;
overflow-y: scroll;
-webkit-perspective: @perspective;
perspective: @perspective;
-webkit-perspective-origin-x: 100%;
perspective-origin-x: 100%;
}
.parallax {
.parallax-variant();
}
.parallax-wrapper {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.parallax-group {
position: relative;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.parallax-group-variant(@z-value) {
z-index: @z-value;
}
.parallax-group-1 {
.parallax-group-variant(100);
}
.parallax-group-2 {
.parallax-group-variant(200);
}
.parallax-group-3 {
.parallax-group-variant(300);
}
.parallax-group-4 {
.parallax-group-variant(400);
}
.parallax-group-5 {
.parallax-group-variant(500);
}
.parallax-abs-layer {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
-webkit-transform-origin-x: 100%;
transform-origin-x: 100%;
}
.parallax-rel-layer {
position: relative;
-webkit-transform-origin-x: 100%;
transform-origin-x: 100%;
}
.parallax-layer-variant(@z-value; @z-index; @perspective: @perspective-default) {
.scale(@z-value, @perspective);
-webkit-transform: translateZ(@z-value) scale(@scale);
transform: translateZ(@z-value) scale(@scale);
z-index: @z-index;
}
.parallax-layer_3 {
.parallax-layer-variant(87px, 4);
}
.parallax-layer_2 {
.parallax-layer-variant(75px, 3);
}
.parallax-layer_1 {
.parallax-layer-variant(50px, 2);
}
.parallax-layer_1 {
.parallax-layer-variant(25px, 1);
}
.parallax-layer_0 {
.parallax-layer-variant(0, 0);
}
.parallax-layer_-1 {
.parallax-layer-variant(-25px, -1);
}
.parallax-layer_-2 {
.parallax-layer-variant(-50px, -2);
}
.parallax-layer_-3 {
.parallax-layer-variant(-100px, -3);
}
.parallax-layer_-4 {
.parallax-layer-variant(-200px, -4);
}
.parallax-layer_-5 {
.parallax-layer-variant(-400px, -5);
}
.debug-on .parallax-group {
-webkit-transform: translate3d(800px, 0, -800px) rotateY(30deg);
transform: translate3d(800px, 0, -400px) rotateY(25deg);
}
.debug-on .parallax-layer {
box-shadow: 0 0 0 2px #000;
opacity: 0.9;
}