0 Replies Latest reply on Feb 17, 2016 8:02 AM by tibewww

    start animation when is visible ?

    tibewww

      Hi everybody,

       

      I went through all tutorials, but i can't mange to make this work, I am wondering if it's due to the latest version of Edge ?

       

      I'm looking to achieve is to have the animation starting only when it is visible in the browser.

       

      One of the Code i tried so far is to add on the Stage this action (Creationcomplete)

       

       

      function isScrolledIntoView(elem)

              {  var docViewTop = $(window).scrollTop();

                  var docViewBottom = docViewTop + $(window).height();

                  var elemTop = $(elem).offset().top;

                  var elemBottom = elemTop + $(elem).height();

                  return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom)

                    && (elemBottom <= docViewBottom) &&  (elemTop >= docViewTop) );

              }        

       

              if(isScrolledIntoView(sym.element)) {

                  sym.play(0)

       

              } else {

                  $(window).on("scroll", function(e) {

                  if(isScrolledIntoView(sym.element)) {

                      console.log('Start me up');  

                      sym.play(0);

                      $(window).off("scroll");

                  }

              });

              }

       

       

       

      But no luck
      If anybody have any advise, it will be amazing !

       

      thank you for all your help