-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
36 lines (23 loc) · 1 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
let navbar = document.querySelector('.header .navbar')
document.querySelector('#menu').onclick = () =>{
navbar.classList.add('active');
}
document.querySelector('#close').onclick = () =>{
navbar.classList.remove('active');
}
// mousemove home img
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.innerWidth - e.pageY*speed)/120
layer.style.transform = `translateX(${x}px) translateY(${y}px)`
})
}
gsap.from('.logo', {opacity: 0, duration: 1, delay: 2, y:10})
gsap.from('.navbar .nav_item', {opacity: 0, duration: 1, delay: 2.1, y:30, stagger: 0.2})
gsap.from('.title', {opacity: 0, duration: 1, delay: 1.6, y:30})
gsap.from('.description', {opacity: 0, duration: 1, delay: 1.8, y:30})
gsap.from('.btn', {opacity: 0, duration: 1, delay: 2.1, y:30})
gsap.from('.image', {opacity: 0, duration: 1, delay: 2.6, y:30})