Jump to content
Search Community

Pieter

Members
  • Posts

    4
  • Joined

  • Last visited

Pieter's Achievements

1

Reputation

  1. Oh, doh. I think you somehow finally made me understand callbacks, thanks for that!
  2. I want to run a certain function once per repeat. For instance, here onComplete only gets called once, not 5 times. function incremental() { console.log("Someone's calling me!"); } function timeline() { return new TimelineMax({ repeat: 5 }) .to(document.getElementById("somediv"), 1, { rotation: 180, onComplete: incremental() }) .play() } timeline(); Is there a way I could do this easily in TweenMax?
  3. Ah yes, much cleaner That answers my question, however, in the code with my for loop, I use { left: "+=55" } to increment relative to the previous iteration. This doesn't seem to work when using the repeat property (it resets itself every time the timeline is repeated). This particular case it can be worked around easily since it's just a linear tween from start to finish, but imagine I used a different easing or timing. Is there a way to fix that or should I use a different approach?
  4. Hey I'm new to using TweenMax, There's one thing I've been doing but I'm wondering if there's a better way, I often need to repeat a number of events... it's kind of like a movieclip in flash. So in this example I'm trying some sort of Hanna Barbara style walkcycle. I just call the function inside my timeline. function walkcycle(timeline, element, repeats) { for (var i = 0; i < repeats; i++) { timeline .add("step") .to(element, 0.2, { bottom: -4, ease: Power2.easeIn }) .to(element, 0.35, { bottom: 0, ease: Power1.easeInOut }) .to(element, 0.55, { left: "+=55" , ease: Power0.easeNone }, "step"); } } But I wonder if there's a better way using TweenMax methods? It works but it's not always ideal. It also breaks chaining.
×
×
  • Create New...