I have a logo split into three parts. And wan't to make some parts disappear (and reappear) based on scroll. But the animation is acting totally weird (not doing the thing I ask it to – yeah, I know it does. But the logic kind of always goes out the window with this).
(couldn't make codepen, jsfiddle or js bin work due to the scroll ... )
But this SHOULD be fairly simple. Make some part disappear, and have the container move up a bit after a delay, and the reverse ...
let duration = 1;
$window.scroll(function () {
if ( $window.scrollTop() > 200 ) {
TweenMax.to('.logo span.one, .logo span.three duration, { opacity: 0, ease: Power0.easeNone } );
TweenMax.to('.logo', duration, { top: '-50px', ease: Power0.easeNone, delay: duration } );
} else {
TweenMax.to('.logo', duration, { top: 0, ease: Power0.easeNone } );
TweenMax.to('.logo span.one, .logo span.three duration, { opacity: 1, ease: Power0.easeNone, delay: duration } );
}
});
I simply don't get why the animation seem random; showing, hiding, moving up and down. Never ending in a state expected.
Anyone got any idea what I'm missing (again)?