-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
46 lines (35 loc) · 798 Bytes
/
main.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
import "reset-css";
import "./style.scss";
import $ from "jquery";
import gsap from "gsap";
const $cursor = $("#cursor");
const $section = $("#container > section");
function followCursor(event) {
gsap.to($cursor, {
x: event.clientX,
y: event.clientY,
});
}
function coverShade() {
const shade = $(".shade", this);
gsap.to($cursor, { opacity: 0 });
gsap.to(shade, {
width: 800,
height: 800,
translateX: -400,
translateY: -400,
});
}
function uncoverShade() {
const shade = $(".shade", this);
gsap.to($cursor, { opacity: 1 });
gsap.to(shade, {
width: 0,
height: 0,
translateX: 0,
translateY: 0,
});
}
$(window).on("mousemove", followCursor);
$($section).on("mouseenter", coverShade);
$($section).on("mouseleave", uncoverShade);