tweenjs / es6-tween

ES6 version of tween.js
MIT License
186 stars 34 forks source link

Tween only run first time since 5.4.x #65

Closed homerjam closed 5 years ago

homerjam commented 5 years ago

Repro url: https://codesandbox.io/embed/24w5k8v3zn

Describe the bug Since version 5.4.x tweens seem to only play first time around. For example I have the following code which creates and runs a new tween programatically, this works as expected in 5.3.x but only works the first time in 5.4.x.

I see there were some changes that mention timeline - could this be something to do with it?

Thanks

    watch() {
      new Tween({ offset: this.alternate ? 0 : 1 })
        .to({ offset: this.alternate ? 1 : 0 }, this.speed)
        .easing({
          offset: Easing.Quadratic.InOut,
        })
        .on('update', this.render)
        .start();
    },

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

dalisoft commented 5 years ago

Hello and thanks for using this library. Please, can you create simple codepen snippet for i am being able to see what happens and fixing issue

homerjam commented 5 years ago

https://codesandbox.io/embed/24w5k8v3zn

I would expect the tween to run every time I click (it does with 5.3.x)...

dalisoft commented 5 years ago

Thanks @homerjam. I got what going wrong, i soon fix. There you can watch minimal pen of what's wrong: https://jsbin.com/luyizar/edit?js,console

dalisoft commented 5 years ago

@homerjam Can you try v5.4.2? It is fixed for your app?

i see, it works if yes, please close issue

homerjam commented 5 years ago

Yes it works! (tested with 5.4.3) Thanks!