Jump to content
Search Community

jukoor

Members
  • Posts

    3
  • Joined

  • Last visited

jukoor's Achievements

1

Reputation

  1. Hi, i'm having a timeline that animates 6 cubes in, one after another. Code is like this: // loop here timeline.add(TweenMax.to(cubes[i].rotation, 1, { y: THREE.Math.degToRad(-90) }, 0), delay); delay += 0.5; timeline.play(); Now my question is, can i run some custom javascript code right after each timeline step? Something like showing an alert after each single animation of the timeline has finished. Like a onComplete Callback for single Timeline Steps ? I hope i made my problem clear, if not i can give you more Infos. regards, julian
  2. Ok i solved it after some extensive logging. It had nothing to with TweenMax, but with my add / remove event listeners for changing scenes. They had wrong / different references to their callbacks, so they didn't got removed. This caused some kind of reference error which was the reason for the animation running only once. Nevertheless thanks, this topic can get closed.
  3. Hi all, I'm programming a small game with three.js which currently has 2 states : mainmenu and level-select. In mainmenu i have a Timeline to animate some cubes in and out, code: function startAnim() { _mainmenu.splitAnimationTimeline = new TimelineMax({ repeat: -1, repeatDelay: 1, yoyo: true, ease: Linear.easeNone, paused: true }); // gets added in a nested loop _mainmenu.splitAnimationTimeline.to(_mainmenu.cubesArr[counter].position, 1, { x: i * moveOffset, y: j * moveOffset, z: k * moveOffset }, 0.5); _mainmenu.splitAnimationTimeline.play(); } This is the main animation, some cubes that move in and out with the repeat and yoyo set. That works all good. Now when i press the start-button i want to switch scene to level-select. Before actually switching i want to stop the current animation and tween the animation back to progress = 0 (another timeline is used to tween the progress of splitAnimationTimeline to 0). This is the Logic of the animation reset: var reverseFinishAnimations = new TimelineMax({ }); reverseFinishAnimations.to(_mainmenu.splitAnimationTimeline, 1.5, { progress: 0, // the problem is here. this works well on first try, but when i switch scene to level-select and back to main menu // everything works, the oncomplete below fires after 1.5s but without the animation playing onComplete: function() { // change to other scene }); The Problem is this works fine on the first try but when i switch back from level-select to main menu (and call startAnim()) the reverseFinishAnimations animation does not tween the progress, BUT does fire the onComplete callback. So i guess the problem lies somewhere in the switching of main menu to level select and by calling the startAnim Function more than once. I hope that i could explain where my problem ist, its not easy to put up a fiddle on that one but i will if it helps. Cheers
×
×
  • Create New...