Jump to content
Search Community

Steffen

Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • Location
    Germany

Steffen's Achievements

0

Reputation

  1. Shure "+=0" is default, but you can't leave out the first parameter. Gives me errors. I came up with another idea to fix my last "problem" function resumeLine(timeLine, time) { var initial_paused_at = timeLine.time(); TweenLite.delayedCall(time, function(){ var diff = initial_paused_at-timeLine.time(); if( (diff < 0.0000001) && (diff > -0.0000001) ) // 'cause float is inaccurate timeLine.play(); }); } Edit: if you scroll back while pause is running and hit again addpause, you will end up having two delayed calls. The first will be finished first and too early. I came up with another version. Only disadvantage i see so far: you've got a global variable. In case of more than one timeline you can get problems. var glb_resume = null; function resumeLine(timeLine, time) { var initial_paused_at = timeLine.time(); if(glb_resume!=null) glb_resume.kill(); glb_resume = TweenLite.delayedCall(time, function(){ var diff = initial_paused_at-timeLine.time(); if( (diff < 0.0000001) && (diff > -0.0000001) ) timeLine.play(); glb_resume = null; }); } Any feedback is welcome.
  2. Thanks, that works almost like a charm! Only problem here: if someone presses play and pause while delayedcall is not yet done it will start playing... I just need some extra logic to deal with that. Youre sample code has some minor typos: TweenLite.delayedCall(time, function(){ ... }); timeline.addPause("+=0", resumeLine, [mainTimeLine, 2]);
  3. Hi there, i've got a similar question. I also want to wait for some time, but without adding it to the duration of the whole timeline (e.g. Slider is not moving). One way would be: function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds){ break; } } } var timeline = new TimelineLite(); timeline.add( TweenLite.fromTo("h1", 0.5, {left:-200,top:-200}, {left:30,top:30}) ); timeline.call(sleep, [2000]); timeline.add( TweenLite.fromTo("h1", 0.5, {left:30,top:30}, {left:-200,top:-200}) ); I know its nasty. Is there a better way doing it with GSAP directly?
×
×
  • Create New...