-
Notifications
You must be signed in to change notification settings - Fork 0
Why Refactor Tween.js?
Carl Olsen edited this page Apr 18, 2014
·
5 revisions
IMO (@unstoppableCarl) Tween.js abstracted away almost all important implementation details making it impossible to implement advanced usage. It was designed (seemingly on purpose) to not be extendable / flexible.
For a game I am working on I needed a tweening library
Requirement | Tween.js | Needs |
---|---|---|
Performant Tweening | Yes | Yes |
Easing | Yes | Yes |
Interpolation | Yes | Yes |
Work in nodejs / browserify | No | Yes |
Simple to extend | some callbacks but only passed target object as param, no prototype use on objects | tween object, target, and progress |
Performant config | config settings set with chainable functions | in a game loop so many extra functions cost to much performance. |
Tween config object | chainable setters, cannot read them after they are set | portable and composable tween settings readable after setting |
Separation of tween objects and update queue | tightly coupled, tween objects add and remove themselves from a global queue | efficient game loop |
Multiple update queues | No | Yes |
Observe the internal state of tween | No | debugging |
Despite all of these problems Tween.js was simple enough that I could refactor it to meet my needs and it is pretty reliable and battle tested.