digital-theory/js/main.js

62 lines
1013 B
JavaScript
Raw Normal View History

2023-04-21 23:27:42 +02:00
anime({
targets: '#main_title',
2023-04-24 15:10:58 +02:00
top: ['240px', '100px'],
opacity: ['0', '1'],
2023-04-21 23:27:42 +02:00
easing: 'easeInOutQuad'
});
2023-04-21 23:27:42 +02:00
anime({
targets: '#hand',
2023-04-24 15:21:22 +02:00
top: ['0px', '100px'],
2023-04-21 23:27:42 +02:00
easing: 'easeInOut'
});
2023-04-24 15:10:58 +02:00
2023-04-21 23:27:42 +02:00
anime({
targets: '#cover h2',
2023-04-24 15:10:58 +02:00
opacity: ['0.5', '1'],
2023-04-21 23:27:42 +02:00
easing: 'easeInOut'
});
2023-04-24 15:10:58 +02:00
anime({
targets: '#phone-watches-1',
left: ['-5vw', '0vw'],
top: ['50vh', '45vh'],
easing: 'easeInOut'
});
// Add timeline
let tl1 = anime.timeline({autoplay: false});
let s1a2 = {
2023-04-24 15:21:22 +02:00
targets: '#hand',
top: ['0px', '100px'],
easing: 'easeInOut'
2023-04-24 15:10:58 +02:00
};
2023-04-24 15:21:22 +02:00
2023-04-24 15:10:58 +02:00
// Add children
2023-04-24 15:21:22 +02:00
tl1.add(s1a2, '-=10');
2023-04-24 15:10:58 +02:00
let controller = new ScrollMagic.Controller();
//Add first scrollmagic scene
let scene1 = new ScrollMagic.Scene({
triggerElement: "#cover",
triggerHook: 0.5,
reverse: false
})
// Add debug indicators
.addIndicators({
colorTrigger: "black",
colorStart: "blue",
colorEnd: "red",
indent: 10
})
// Trigger animation timeline
.on("enter", function (event) {
tl1.play();
})
.addTo(controller);