-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
34 lines (24 loc) · 1.17 KB
/
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
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')
})
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.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.6, 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.3, y: 30})