forked from WebDevSimplified/logical.so-scroll-animation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyles.css
113 lines (94 loc) · 1.76 KB
/
styles.css
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
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
margin: 0;
color: #141616;
background-color: #e6e9ea;
font-size: 28px;
}
h1 {
font-size: 110px;
margin-bottom: 1rem;
}
.full-screen-section {
height: 100vh;
text-align: center;
padding: 1rem;
position: relative;
}
.top-section .left,
.top-section .right {
flex-basis: 0;
flex-grow: 1;
padding: 1rem;
padding-left: 3rem;
}
.top-section {
display: flex;
text-align: start;
padding: 0;
}
.top-section .left {
background-color: rgb(248, 250, 249, var(--background-opacity));
}
.top-section .right {
background: linear-gradient(
210.65deg,
rgb(152, 157, 157, var(--background-opacity)) 0%,
rgb(189, 194, 194, var(--background-opacity)) 100%
);
}
.imgs > .top-section-img {
/* (oldVal - oldMin) * newRange / oldRange + newMin */
--value: min(var(--scroll), 30) * 50 / 30;
width: calc(50vw + 1vw * var(--value));
transform: translateY(calc(50% - 1% * var(--value)));
}
@media (width <= 1000px) {
.top-section .right {
display: none;
}
.top-section .left {
text-align: center;
}
body {
font-size: 24px;
}
h1 {
font-size: 72px;
}
.imgs > .top-section-img {
width: 100vw;
}
}
:root {
--scroll: 0;
}
.top-section {
position: sticky;
top: 0;
/* (oldVal - oldMin) * newRange / oldRange + newMin */
translate: 0 calc(-1% * (max(var(--scroll), 25) - 25) * 100 / 75);
--background-opacity: calc(100% - 1% * min(var(--scroll), 30) * 100 / 30);
}
.first-main-section {
padding-top: 10vh;
}
.imgs > * {
position: fixed;
width: 100vw;
bottom: 0;
z-index: 10;
translate: 0 100%;
transition: translate 250ms ease-in-out;
}
.imgs > .show {
translate: 0 0;
}
[data-img-to-show] {
position: absolute;
top: 20%;
}