-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (26 loc) · 1.19 KB
/
index.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
const navMenu = document.getElementById('nav-menu'),
toggleMenu = document.getElementById('nav-toggle'),
closeMenu = document.getElementById('nav-close')
toggleMenu.addEventListener('click', ()=>{
navMenu.classList.toggle('show')
})
closeMenu.addEventListener('click', ()=>{
navMenu.classList.remove('show')
})
//MouseMovement
document.addEventListener('mousemove', move)
function move(e){
this.querySelectorAll('.move').forEach(layer =>{
const speed = layer.getAttribute('data-speed')
const x = (window.innerWidth - e.pageX*speed)/120
const y = (window.innerHeight - e.pageY*speed)/120
layer.style.transform = `translateX(${x}px) translateY(${y}px)`
})
}
//Gsap Animation
gsap.from('.nav_logo, .nav_toggle', {opacity: 0, duration:1, delay: 2, y:10})
gsap.from('.nav_item', {opacity: 0, duration:1, delay: 2.1, y:30, stagger:0.2})
gsap.from('.home_title', {opacity: 0, duration:1, delay: 1.5, y:30})
gsap.from('.home_description', {opacity: 0, duration:1, delay: 1.8, y:30})
gsap.from('.home_button', {opacity: 0, duration:1, delay: 2.1, y:30})
gsap.from('.home_img', {opacity: 0, duration:1, delay: 1.4, y:30})