tweenjs / es6-tween

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

[Feature] onRequestTick #52

Closed moroine closed 6 years ago

moroine commented 6 years ago

Add TWEEN.onRequestTick that can be used to notify when another animation frame is needed.

This can be used when autoPlay is false and the user wants on demand animation frame rather than continuous one.

Also, Fix TWEEN.FrameThrottle which wasn't expose

dalisoft commented 6 years ago

@moroine Thank you for your PR, but please back stopTicker when 120 frames without tweens. If you not back that function, i can't merge, sorry. In desktop browsers this is even not needed, but for mobile devices, it's important

dalisoft commented 6 years ago

@moroine I will merge, i don't have much time test these functions and others. Anyway there small community and 2-3 people there only contributing, others not, so, i think only for users like you use it. You working well on features, good work =))

dalisoft commented 6 years ago

I will add you to NPM, but, please, don't use old and evil or code for cracking do not use =) I see you want to help, but i am should warn you about it, we will help peoples to making their animations nice, please can you confirm that your username in NPM is same as github?

dalisoft commented 6 years ago

I added you to NPM package as maintainer, don't remove package, keep alive project :)

dalisoft commented 6 years ago

@sole Can you add @moroine as Collaborator? I now haven't a lot of time like before, sorry

moroine commented 6 years ago

@moroine Thank you for your PR, but please back stopTicker when 120 frames without tweens.

In order to call onRequestTick only when it's needed, I had to put first if (emptyFrame >= powerModeThrottle) ... in order to prevent adding an onCancelRequestTick which would be hard for a user to use.

So in that case, we also only call _ticker when it's really needed, and we don't need to cancel it so the stopTicker wasn't used anymore.

I will add you to NPM, but, please, don't use old and evil or code for cracking do not use =) I see you want to help, but i am should warn you about it, we will help peoples to making their animations nice, please can you confirm that your username in NPM is same as github?

Yeah my username is the same: https://www.npmjs.com/~moroine

I added you to NPM package as maintainer, don't remove package, keep alive project :)

That's awesome! I don't have much time and you only add features when I need to, but will try to review with you eventual PRs.

dalisoft commented 6 years ago

Thank you, great work. I added you already to NPM, did you get notification? If yes, happy coding =)

moroine commented 6 years ago

Thank you, great work. I added you already to NPM, did you get notification? If yes, happy coding =)

Yeah I got it, thanks