Animation prototype
Nobody has claimed this yet.
Assessment
This issue has not been assessed yet.
Description
Looking into a prototype for general animation (as noted by https://github.com/phetsims/joist/issues/404).
I've checked in some code that is not refined or final by any means.
Some thoughts/opinions:
- We'll want to attach animations to Properties (handling numbers/vectors or possibly other things), object properties (like linkAttribute), or handle with callbacks.
- the
first.blend( second, ratio )function (like Vector2/etc. has) sounds like a good default candidate for interpolating between non-numbers. - Have an
Animatorthat tracks (and steps) multiple animations, removing animations as necessary when they are complete. We may want to just call step() once without having to manually track ephemeral animations (but still want the flexibility to manually reference and step animations themselves). - Prototype should be able to handle animating colors (with blending functions), opacity, translations, rotation, etc.
- Step function on animations should return how much time has elapsed since the animation would have ended, so that chained animations can function properly (queueing one animation right after another)
- "Stacking" easing animations sounds like the most useful way to handle starting one easing before ending another. Ease animations should animate (possibly with deltas) from "where our existing animations will take us" to the "animation target". Thus multiple easing animations running currently should result in a nice visual behavior (with speed-ups for cases where someone clicks rapidly through a carousel, etc.)
- Easing duration could also be computed instead by a maximum speed allowed for the particular easing. I already have the polynomial (linear/quadratic/cubic/etc.) easing curves and the two derivatives implemented, so it's fairly trivial to compute maximum speed.
- Spline/keyframe based animation (it's not simple easing) and damped motion should both be considered, as they have their somewhat separate uses. See what can be integrated in all of them.
// possible examples for easing -- potentially auto-starting
animator.ease( locationProperty, targetProperty, {
easing: Easing.CUBIC_IN_OUT,
duration: 1.5
} ).start(); // Do we need a start(), or can it be implicit? May need for chaining
animator.ease( node, 'opacity', targetOpacity, { duration: 0.5 } );
animator.ease( currentValue, targetValue, function( value ) { ... }, { duration: ... } );
animator.step( dt );
var animation = animator.ease( ... );
animation.stop();
// ...
animation.restart();
animation.chain( animator.ease( ... ) ); // After one is done, start another
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from phetsims/twixt
-
Readme makes it seem like twixt is a work in progressMay be free again @brettfiedler claimed this 787 days ago, and no pull request is open. Openbeginner-friendly good-first-issue type:documentation type:open-source-ecosystem
-
design:general
-
priority:5-deferred type:bug
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
why is Easing a type?May be free again @jonathanolson claimed this 2726 days ago, and no pull request is open. Opendev:code-review type:question
-
add unit tests for EasingMay be free again @jonathanolson claimed this 2067 days ago, and no pull request is open. Opendev:enhancement
Similar issues
-
resources
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
railmapgen/rmg-palette#2445 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
danielmiessler/LifeOS#2242 ·
Maintainers usually reply within 5 days
-
good first issue hacktoberfest help wanted translation
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
callstackincubator/appduct#129 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100