-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrollanimation.html
More file actions
81 lines (71 loc) · 1.98 KB
/
scrollanimation.html
File metadata and controls
81 lines (71 loc) · 1.98 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
min-height: 200vh;
background: #222;
}
section {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background: black;
display: flex;
justify-content: center;
align-items: center;
clip-path: circle(100px at left center);
z-index: 2;
}
.title {
position: fixed;
top: 50%;
transform: translateY(-50%);
width: 100%;
text-align: center;
color: aquamarine;
z-index: 1;
font-size: 25vw;
}
.inner-title {
position: fixed;
top: 50%;
transform: translateY(-50%);
width: 100%;
text-align: center;
color: aqua;
font-size: 25vw;
background: url(images/walls.jpg);
background-attachment: fixed;
background-size: cover;
background-position: center;
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
</style>
</head>
<body>
<h2 class="title">Hello</h2>
<section>
<h2 class="inner-title">Hello</h2>
</section>
<script>
let section = document.querySelector("section");
window.addEventListener("scroll", function () {
let value = window.scrollY;
section.style.clipPath = "circle(" + value * 3 + "px at left center)"
})
</script>
</body>
</html>