Skip to content

Commit 2b31ef2

Browse files
Pin intro title and swipe it out of screen on scroll
1 parent aa1842c commit 2b31ef2

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

js/main.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const vh = window.screen.availHeight / 100;
2+
3+
const controller = new ScrollMagic.Controller();
4+
5+
const introTitlePin = new ScrollMagic.Scene({ triggerElement: '.intro__title', triggerHook: 0 })
6+
.setPin('.intro__title')
7+
.addTo(controller);
8+
9+
const titleSwipe = new ScrollMagic.Scene({ triggerElement: '.intro__title', triggerHook: 0, duration: 50 * vh })
10+
.setTween(new TweenLite.fromTo('.intro__title', 1, { x: 0 }, { x: '100%' }))
11+
.addTo(controller);

0 commit comments

Comments
 (0)