Open
Description
Proposed (welcome to debate):
- Ensure maximal ES Module support
- remove legacy CommonJS after Electron ESM comes out
- Remove the
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).- This also allows us to eliminate confusion with
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()
.
- This also allows us to eliminate confusion with
- Remove the
TWEEN
singleton, makeTween
s start with noGroup
by default- docs: Teach people how to make a Tween and update it directly.
- docs: Teach them that if they want to update multiple
Tween
s at once, they must make aGroup
. - This eliminates possible errors people will have when they clash tweens from two or more separate pieces of code (when using the current
TWEEN
) - explicitly managing each tween, or explicitly making Groups, will naturally lead to people writing componentized code with lowered chance of issues.
- this leads to understanding of what is going on, rather than proper code being non-obvious up front
- Remove relative values. It involves detecting strings for little convenience. People can just use math on their side with not much more effort.
- Remove the dynamic-to feature. It isn't used often, and much internal complication.
- Remove array of to-values.
- Also adds quite some complexity.
- It seems that when we do this, we inadvertently destroy the meaning of an easing curve because the actual number output is no longer on that curve so the meaning is obscure, unless we do very special math to determine proper values to use such that a new curve makes sense.
- The same math skill required for the previous point may instead be used to chain multiple tweens together, which gives more capabilities such as specific curves between each value. To emulate the array of values, chain tweens together with linear curves, then interpolate all of them with a single higher-level tween using a single curve.
- The previous point allows much more options than the inflexible feature of to-values. To-values is a shortcut for the previous point with a linear chain and directing tween.
- Downside: lose ability to choose interpolation method, f.e. bezier, which is useful for making a smooth curve out of the discrete to-values (f.e. "animate along a smooth path calculated from the discrete sharp values").
- provide an alternative that doesn't complicate tween directly? F.e. Three.js has Path and Curve tools, instead animate position along such primitives specialized for that purpose. Perhaps we show a demo of that here, after removing to-values.
- Remove or replace
.yoyo
. Provide areverse
function that can return a new tween instance with reversed data.- simplifies tween logic.
- then:
tween.chain(tween.reverse().chain(tween))
- Perhaps instead of removing,
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.
- Replace
tween.chain
with a Sequence (or more advanced Timeline) feature.- This composes tween independently of each other, so they don't need to have state remembering who they are chained to. This allows way more flexible new options (Timeline) like playing tweens in parallel, not just in sequence, etc.
- improved testing.
- run unit tests in browsers, because that's where Tween is used more often.
- Add a way to perform visual snapshot testing so that we may catch issues that unit tests may not, by snapshotting results of visual animations
What else?
Metadata
Metadata
Assignees
Labels
No labels