-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
51 lines (47 loc) · 1.4 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//sticky nav
const nav = document.querySelector('.flex-nav');
const navTop = nav.offsetTop;
const stickyNavigation = () => {
if (window.scrollY >= navTop) {
document.body.style.paddingTop = nav.offsetHeight + 'px';
document.body.classList.add('fixed-nav');
} else {
document.body.style.paddingTop = 0;
document.body.classList.remove('fixed-nav');
}
}
window.addEventListener('scroll', stickyNavigation);
//intro blurb animation
// Wrap every letter in a span
var textWrapper = document.querySelector('.ml11 .letters');
textWrapper.innerHTML = textWrapper.textContent.replace(/([^\x00-\x80]|\w)/g, "<span class='letter'>$&</span>");
anime.timeline({loop: true})
.add({
targets: '.ml11 .line',
scaleY: [0,1],
opacity: [0.5,1],
easing: "easeOutExpo",
duration: 700
})
.add({
targets: '.ml11 .line',
translateX: [0, document.querySelector('.ml11 .letters').getBoundingClientRect().width + 10],
easing: "easeOutExpo",
duration: 700,
delay: 100
})
.add({
targets: '.ml11 .letter',
opacity: [0,1],
easing: "easeOutExpo",
duration: 5000,
offset: '-=775',
delay: (el, i) => 34 * (i+1)
})
//.add({
// targets: '.ml11',
// opacity: 0,
// duration: 1000,
// easing: "easeOutExpo",
// delay: 1000
//});