-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcursor.js
65 lines (56 loc) · 1.83 KB
/
cursor.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
let cursor = document.querySelector('.cursor');
let blob = document.querySelector('.blob');
let video = document.querySelector('.video video');
let images = document.querySelectorAll('.image .grid-effect');
let underline_links = document.querySelectorAll('.underline-button');
let tictac_links = document.querySelectorAll('.round-button');
let projects_div = document.querySelector('.projects');
footer_links = document.querySelectorAll('.footer a');
window.addEventListener('mousemove', function(e) {
cursor.animate({
top:e.pageY + 'px',
left:e.pageX + 'px'
}, {duration:1000, fill:'forwards'});
blob.animate({
top:e.pageY + 'px',
left:e.pageX + 'px'
}, {duration:7000, fill:'forwards'});
});
images.forEach(image => {
image.addEventListener('mouseover', function() {
cursor.style.background = 'white';
})
image.addEventListener('mouseleave', function() {
cursor.style.background = '#6A6BF4';
})
})
underline_links.forEach(link => {
link.addEventListener('mouseover', function() {
cursor.style.width = 0;
cursor.style.height = 0;
})
link.addEventListener('mouseleave', function() {
cursor.style.width = '1.5vw';
cursor.style.height = '1.5vw';
})
})
footer_links.forEach(link => {
link.addEventListener('mouseover', function() {
cursor.style.width = 0;
cursor.style.height = 0;
})
link.addEventListener('mouseleave', function() {
cursor.style.width = '1.5vw';
cursor.style.height = '1.5vw';
})
})
tictac_links.forEach(link => {
link.addEventListener('mouseover', function() {
cursor.style.width = 0;
cursor.style.height = 0;
})
link.addEventListener('mouseleave', function() {
cursor.style.width = '1.5vw';
cursor.style.height = '1.5vw';
})
})