Search code examples
gsap

Looping Master or Scene and restoring original position of elements


I try to loop a complete header animation endlessly, but I just cannot get it to work: https://codepen.io/Sixl/pen/jwXGqd

I tried to loop the master like this:

var master = new TimelineMax({repeat:-1});

Then I tried the same solution on the single scene I'm using:

  function sceneOne() {
    var tl = new TimelineMax({repeat:-1});

I also tried several solutions with oncomplete callbacks.

I finally had some experiments with

timeline.seek(0).pause();
timeline.pause(0); //shortcut for the line above
timeline.progress(0).pause();
timeline.totalProgress(0).pause();
timeline.restart(0).pause();

inside my scene. Didn't help.

Can somebody point me in the right direction? I cannot find any error in my code.


Solution

  • It is the entry_heroes section that is causing the problem as it has itself a repeat: -1 that means that the section never ends and so the whole timeline never finishes and thus does not repeat.