質問

I was wondering if it was possible to have a function start only after the previous function completed. I have two functions listed below that I'm trying to run one after the other. Thanks!

                var controller = $.superscrollorama();


                controller.addTween('#graphicOne', TweenMax.from( $('#graphicOne'), .7, {css:{right:'1000px'}, ease:Back.easeOut}));
                controller.addTween('#graphicTwo', TweenMax.from( $('#graphicTwo'), .7, {css:{left:'1000px'}, ease:Back.easeOut})); 
                controller.addTween('#graphicThree', TweenMax.from( $('#graphicThree'), .7, {css:{right:'1000px'}, ease:Back.easeOut}));        
            }

Function 2:

        function footerAnimation() {
            TweenMax.from( $('#footerTextLight'), .7, {css:{opacity:'0'}})
        }
役に立ちましたか?

解決

use onComplete callback

controller.addTween(
       '#graphicThree', 
       TweenMax.from( $('#graphicThree'), .7, 
                     {
                     css:{right:'1000px'},
                     ease:Back.easeOut, 
                     onComplete : footerAnimation
                    }
                  )
       );

Pass in a function to the tween for when the animation is complete.

http://johnpolacek.github.io/superscrollorama/

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top