-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
177 lines (161 loc) · 3.42 KB
/
script.js
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
const cursor = document.querySelector("#cursor");
const main = document.querySelector(".main");
const heading = document.querySelector("#mainheading");
const image = document.querySelector(".sec1 img");
const links = document.querySelector(".con_links");
const sec2 = document.querySelector(".sec2");
const head2 = document.querySelector(".sec2 h2");
const line = document.querySelector(".line")
const line2 = document.querySelector(".line2")
const dot2 = document.querySelector(".dot2")
const dot3 = document.querySelector(".dot3");
const line3 = document.querySelector(".line3");
const nav_links = document.querySelector("nav a");
let end = gsap.matchMedia();
main.addEventListener("mousemove",function(dets){
gsap.to(cursor,{
x:dets.x,
y:dets.y,
ease:"back.out",
duration:1,
})
});
gsap.to(image,{
scrollTrigger:{
trigger:image,
start:"top 40%",
end:"top -70%",
pin:true
}
})
image.addEventListener("mouseenter",function(){
gsap.to(cursor,{
height:"40px",
width:"40px",
background:"transparent"
})
});
image.addEventListener("mouseleave",function(){
gsap.to(cursor,{
height:"5px",
width:"5px",
background:"black"
})
});
gsap.from(sec2,{
opacity:"0",
scrollTrigger:{
trigger:sec2,
start:"top 60%",
end:"top -60%",
}
});
head2.addEventListener("mouseenter",function(){
gsap.to(cursor,{
height:"40px",
width:"40px"
})
});
head2.addEventListener("mouseleave",function(){
gsap.to(cursor,{
height:"20px",
width:"20px"
})
})
end.add("(max-width:425px)",()=>{
gsap.to(sec2,{
opacity:"100%",
})
gsap.to(image,{
scrollTrigger:{
trigger:image,
start:"top 50%",
end:"top 10%",
}
})
})
image.addEventListener("mouseenter",function(){
gsap.to(cursor,{
background:"transparent",
})
})
image.addEventListener("mouseleave",function(){
gsap.to(cursor,{
background:"black",
})
});
links.addEventListener("mouseenter",()=>{
gsap.to(cursor,{
height:"4rem",
width:"4rem",
background:"gold",
})
cursor.innerHTML="Click Here";
})
links.addEventListener("mouseleave",()=>{
gsap.to(cursor,{
height:"5px",
width:"5px",
background:"black",
})
cursor.innerHTML="";
})
gsap.to(line,{
height:"18.5rem",
scrollTrigger:{
trigger:line,
start:"top:30%",
end:"top 40%",
scrub:2
}
})
gsap.to(line2,{
height:"18.5rem",
opacity:1,
scrollTrigger:{
trigger:line2,
start:"top 20%",
end:"top 45%",
opcaity:0,
scrub:2
}
});
gsap.from(dot2,{
opacity:0,
scrollTrigger:{
trigger:dot2,
start:"top 43%",
end:"top 50%",
scrub:2
}
});
gsap.to(line3,{
height:"17.5rem",
opacity:1,
scrollTrigger:{
trigger:line3,
start:"top 20%",
end:"top 45%",
opcaity:0,
scrub:2
}
});
gsap.from(dot3,{
opacity:0,
scrollTrigger:{
trigger:dot3,
start:"top 60%",
end:"top 65%",
scrub:2
}
});
nav_links.addEventListener("mouseenter",()=>{
gsap.to(nav_links,{
color:"purple",
})
})
nav_links.addEventListener("mouseleave",()=>{
gsap.to(nav_links,{
color:"black",
})
})