Skip to content

Conversation

@JaskRendix
Copy link
Contributor

@JaskRendix JaskRendix commented Jul 25, 2025

PR improves the AnimationToken class and related logic.

Here’s what’s changed:

  • replaced NamedTuple with @dataclass for AnimationFrame, this allows future extensibility and enforces immutability with frozen=True
  • refactored AnimationToken constructor and logic: cleaned up how frames are stored, removing unnecessary re-wrapping and simplified frame indexing using modulo arithmetic for looping
  • added loop flag, users can now choose whether the animation repeats or plays once
  • introduced done flag, signals when a non-looping animation is finished, preventing further advancement
  • created update() method, allows animations to self-update based on elapsed time, making frame progression consistent regardless of frame rate or lag
  • enhanced all docstrings, clear descriptions now explain purpose, parameters, return values, and behavior
  • preserved __slots__, keeps memory usage optimized while the class expands in capability
  • fixed typos, corrected "frames that compromise the animation" to "frames that comprise the animation"
  • added simple demo: revised to showcase frame-rate-independent updates using AnimationToken.update() and loop=True, creating smoother visual transitions
  • added group demo: refactored token creation and update flow to demonstrate parallel animations, using randomized positions and separated update/render cycles
  • resolved broken imports by updating pyproject.toml to include the pyscroll package explicitly, fixing editable installs and restoring demo functionality during development (split out in Cleanup legacy build files and add Makefile for tooling #71)

@JaskRendix JaskRendix closed this Oct 5, 2025
@JaskRendix JaskRendix deleted the animation branch December 14, 2025 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant