Skip to content

Animation.frames, deprecate animations as arrays - #60

Merged
matmen merged 1 commit into
masterfrom
animation-frames
Oct 16, 2026
Merged

matmen merged 1 commit into
masterfrom
animation-frames

Conversation

@matmen

@matmen matmen commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Adds animation.frames: the frames as a plain array. Changing it (push(), splice(), …) changes the animation, and it can be replaced as a whole.

Using the animation itself as an array is deprecated. Animation (and GIF) extend Array, so array methods can't behave the way they appear to:

  • map() can return anything, so it returns a plain array.
  • slice() needs an override to keep the class and the loop count.
  • filter() and concat() return plain arrays, although they only ever hold frames.

In 4.0, Animation won't extend Array anymore.

@matmen matmen added this to the v3.2.0 milestone Oct 16, 2026
@matmen matmen self-assigned this Oct 16, 2026
@matmen matmen added the enhancement New feature or request label Oct 16, 2026
Animation extends Array, so its array methods can't be what they seem:
map() can return anything, so it returns a plain array, slice() needs
an override to keep the class and loop count, filter() and concat()
return plain arrays although they only hold frames. animation.frames
is the frames as an array, which changes the animation when it's
changed and can be replaced as a whole. Using the animation itself as
an array is deprecated: in 4.0, Animation won't extend Array.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MLHc7GW46D6BmwtEM2khgr
@matmen
matmen merged commit 6e8730e into master Oct 16, 2026
13 checks passed
@matmen
matmen deleted the animation-frames branch October 16, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant