-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify Tween, remove some stuff, make it easier to maintain. #655
Comments
@MasatoMakino hello! :) If you have some time, we could jam on these ideas. |
@trusktr hello!
|
Yeah, that would be removed. Instead, people would:
Similar to the good practice of avoiding global variables. Pretty much agree with all you said. We definitely need to release the breaking changes in a major version. Tween has numerical outputs, but a few visual tests might catch some edge cases, maybe later once we have a separate Timeline feature. Not sure if worth it yet. |
dynamic-to option is an amazing thing and should not be removed. I've used it and that adds AI-like behaviour to the tween. The Group object still needs a lot of work. Pausing tweens inside a Group terminates them completely, which is not correct. We should be able to do a .startAll() and .pauseAll() on a Group. A .restartAll() and .reverseAll() would be great also. Of course, those functions used on a single tween would be good also. |
@nya13 thank you for the input!
That may indeed be true. The current
Indeed I agree the use case can be desirable, but perhaps the way we currently achieve that use case blurs the concept of a Tween (the curve on which a number transitions between two values), plus makes the Tween class a bunch more complicated. Instead, I believe we can come up with cleaner ways to achieve the same effects. For example, if we keep Tween simple, then we can instead animate along a path, and modify the path dynamically (f.e. modify the path connecting 🐇 that the 🦊 is chasing). In that rabbit-fox example, the concept is actually two concepts that are currently blended together in an unclear way: we have a tween, and we're animating along a path (and the path happens to change shape dynamically). If we update that example to clearly show those two concepts separately, the example will be semantically clear while the Tween class can be simplified. I think we can perhaps provide additional utilities (at copyable from examples) to make this sort of thing easy. Can you provide any more use cases? |
I added a new one to the list:
|
@ronaldcurtis Good point! Haven't removed CJS yet (in fact, the CJS Looks like ESM support in Electron finally landed in August! Docs: https://www.electronjs.org/docs/latest/tutorial/esm Are you using Tween.js with Electron? If so, can you try it out? If it works fine, we can mark the CommonJS module as deprecated with a |
@trusktr Not using Tween.js anymore, but as you mentioned it looks like Electron supports ESM now, so it should be fine to deprecate ^_^ |
Proposed (welcome to debate):
autostart
parameter fromtween.update(time, autostart)
. It makes the API less intuitive: for example if you callstop()
and then the next animation frame callsupdate()
and restarts the tween, it seems likestop()
is not working. Better to make the APIs explicit: tweens will start and stop only when you tell them to, regardless ifupdate
is being called, and update does only one thing well (update the time).onStart
. Currently you calltween.start()
, butonStart
will be be fired untilupdate()
is called (f.e. in the next animation frame). Instead, we can make it be called immediately so that any state that should be initially set for the tween is guaranteed to be set, regardless ofupdate()
.TWEEN
singleton, makeTween
s start with noGroup
by defaultTween
s at once, they must make aGroup
.TWEEN
).yoyo
. Provide areverse
function that can return a new tween instance with reversed data.tween.chain(tween.reverse().chain(tween))
tween.yoyo()
can be a shortcut for the previous point. The main idea is that the yoyo state is not intertwined inside the regular tween state like it currently is. Instead, two separate tweens each have their own state.tween.chain
with a Sequence (or more advanced Timeline) feature.What else?
The text was updated successfully, but these errors were encountered: