Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tweenmax starts animation without waiting for ScrollMagic

I'm trying to get scrollmagic to trigger a TweenMax animation, but the animation starts without waiting for the scroll trigger to be hit. Am I missing something here?

$(document).ready(function($) {
  var controller = new ScrollMagic();

  var tween = TweenMax.to('.animateme', 1, {color: "green", scale: 2.5});

  var scene = new ScrollScene({triggerElement: '.trigger'})
    .setTween(tween)
    .addTo(controller);
  scene.addIndicators({zindex: 100});
});
like image 651
jshou Avatar asked Jan 10 '23 12:01

jshou


1 Answers

It turns out, if you must include ScrollMagic AFTER including TweenMax, otherwise the tween animation will just run and ignore scrolling.

like image 99
jshou Avatar answered Feb 10 '23 23:02

jshou