janpaepke / ScrollMagic

The javascript library for magical scroll interactions.
http://ScrollMagic.io
Other
14.9k stars 2.17k forks source link

ScrollMagic Scene ignores GSAP timeline delay #511

Open mirkonz opened 8 years ago

mirkonz commented 8 years ago

It looks like ScrollMagic is ignoring the GSAP's timeline delay option. Will there be a fix for that?

mrflix commented 8 years ago

Hey Mirko, delays used like this do work:

var scene = new ScrollMagic.Scene();
var tween = new TimelineMax();
tween.from('.slide', 1, { opacity: 0, y: 100, delay: 1});
scene.addTween(tween);

If you post some of your code I can help you spot the error :)

mirkonz commented 8 years ago

But it ignores the timeline delay: This does not work:

var scene = new ScrollMagic.Scene();
var tween = new TimelineMax({delay: 1});
tween.from('.slide', 1, { opacity: 0, y: 100});
scene.addTween(tween);
mrflix commented 8 years ago

Oh okay, sorry for the confusion. Its weird that it doesn't work because judging from the code ScrollMagic hooks to the progress value of the GSAP timeline and updates that value. The progress should include the timelines base-delay: https://github.com/janpaepke/ScrollMagic/blob/master/dev/src/plugins/animation.gsap.js#L146 Have you tried fixing it yourself? A pull request would be awesome!