Skip to content

Set a baseline position: relative during animation - #106

Merged
smoores-dev merged 1 commit into
mainfrom
shuffle/fix-anime-inline
Nov 18, 2026
Merged

smoores-dev merged 1 commit into
mainfrom
shuffle/fix-anime-inline

Conversation

@smoores-dev

Copy link
Copy Markdown
Member

anime.js applies position: absolute to every node except nodes that have
text node siblings. That means an inline node with text siblings keeps its
non-animated position (usually static), but its children get position: absolute.
So then the inline node's children get their animation coords (top, left)
applied, they position themselves relative to their grandparent, rather
than their parent.

To work around this, we apply position: relative to every animated node
with the lowest specificity (0,0,0). anime.js's manual position: absolute
application beats this, so it's a no-op for everything other than
the inline case described above. In that case, the only effect it has
is to prevent children from being positioned relative to their grandparents.

@smoores-dev
smoores-dev force-pushed the shuffle/fix-anime-inline branch from 703eb50 to 5674acf Compare November 18, 2026 18:12
@smoores-dev
smoores-dev merged commit 368fade into main Nov 18, 2026
4 checks passed
@smoores-dev
smoores-dev deleted the shuffle/fix-anime-inline branch November 18, 2026 18:21
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