Animations - interpolate between values over time for most UIDrawable fields #59

Open
opened 2024-03-09 20:52:52 +00:00 by john · 0 comments
Owner

40 feat: Animate arbitrary fields on all the UIDrawables [depends on all UIDrawables use consistent member names]

The purpose of an Animation is for Python code to set up a starting value, ending value, and duration - then get a callback (or an automatic continuation to another Animation) when the animation is done.

Use cases to cover:

  • Discrete: over n milliseconds, set the value to the index closest to t/n. The animated value is in one state or the next one. Frames of a sprite's animation and "scrolling in" text are examples of this
  • Continuous: floating point values can be set to t/n every frame. The value must always be set to the exact target value at the end of the animation.
  • non-linear interpolation: Besides just the fraction of the duration used (t/n), some easing functions would be nice. It's just a single function, float interp(float). Providing these functions from Python is not a high priority, it would violate McRogueFace's tenet of "Don't call Python every frame".

Data types to cover:

  • String or sf::Text; iterating over unicode glyphs doesn't sound fun, but it should work fine (TM) for UTF-8 English, so I've got that going for me.
  • Float (positions, mostly)
  • Int (indexes of a list, mostly)
  • Vector2f (i.e. two floats)
  • Color (i.e. three floats)

Advanced features to ponder:

  • Parallel animations (example: Sprite's discrete frames for walking + Sprite's continuous position between the two tiles)
  • Entity Position: I favor "Pokemon Style" positioning, where a moving entity "instantly" claims the square they are moving do, but can't begin the motion to a new square until the animation is complete. As a result, you may "bump into" someone who is only halfway into a square (because they are already "in" it) or you may clip through someone who is halfway out of a square (because they have already "left" it).

Depends on #56.

40 feat: Animate arbitrary fields on all the UIDrawables \[depends on all UIDrawables use consistent member names] The purpose of an Animation is for Python code to set up a starting value, ending value, and duration - then get a callback (or an automatic continuation to another Animation) when the animation is done. Use cases to cover: * Discrete: over `n` milliseconds, set the value to the index closest to `t/n`. The animated value is in one state or the next one. Frames of a sprite's animation and "scrolling in" text are examples of this * Continuous: floating point values can be set to `t/n` every frame. The value must always be set to the exact target value at the end of the animation. * non-linear interpolation: Besides just the fraction of the duration used (`t/n`), some easing functions would be nice. It's just a single function, `float interp(float)`. Providing these functions from Python is not a high priority, it would violate McRogueFace's tenet of "Don't call Python every frame". Data types to cover: * String or sf::Text; iterating over unicode glyphs doesn't sound fun, but it should work fine (TM) for UTF-8 English, so I've got that going for me. * Float (positions, mostly) * Int (indexes of a list, mostly) * Vector2f (i.e. two floats) * Color (i.e. three floats) Advanced features to ponder: * Parallel animations (example: Sprite's discrete frames for walking + Sprite's continuous position between the two tiles) * Entity Position: I favor "Pokemon Style" positioning, where a moving entity "instantly" claims the square they are moving do, but can't begin the motion to a new square until the animation is complete. As a result, you may "bump into" someone who is only halfway into a square (because they are already "in" it) or you may clip through someone who is halfway out of a square (because they have already "left" it). Depends on #56.
john added the
Major Feature
label 2024-03-09 20:52:52 +00:00
john added the
Alpha Release Requirement
label 2024-03-09 22:53:37 +00:00
john added this to the Alpha Release Targets milestone 2024-03-13 14:41:42 +00:00
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: john/McRogueFace#59
No description provided.