Skip to content

Anim: group animations by sequence in one pass (#410) - #472

Merged
h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
NikitkaRa:anim-trigger-linear
Oct 14, 2026
Merged

h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
NikitkaRa:anim-trigger-linear

Conversation

@NikitkaRa

Copy link
Copy Markdown
Contributor

Summary

  • Timeline::with groups a slide's animations by sequence in a single pass (a HashMap index into an ordered list). Sequence order stays first appearance, main first. Before, each trigger was found with Vec::contains and then all animations were rescanned for every sequence.
  • The build stops at MAX_EFFECTS before starting the next sequence, so nothing past the cap is grouped or filtered again.
  • Paragraph-group dedup (ByParagraph text builds) uses a HashSet instead of Vec::contains on the growing group list.

Test plan

  • cargo test -p deckcraft-anim --lib: new tests for interleaved triggers keeping first-appearance order and step counts, and 110,000 distinct triggers (past the cap) building exactly 100,000 effects in order. The old code needed about 1.2e10 steps for that; the whole suite now runs in 0.11 s
  • cargo xtask ci (fmt, clippy, test, assets, layers, wasm)

Closes #410

Timeline::with found trigger sequences with Vec::contains and then rescanned
every animation once per sequence, and checked MAX_EFFECTS only after a
match, so a slide with many distinct triggers cost quadratic work before the
effect cap could stop it.

Animations are now grouped once (an index by sequence, first-appearance order
kept, main first), the build stops at MAX_EFFECTS before the next sequence,
and paragraph groups are deduplicated with a set instead of Vec::contains.

Co-authored-by: Cursor <cursoragent@cursor.com>
@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit 21c5f8e into storytold:main Oct 14, 2026
@echelon

echelon commented Oct 14, 2026

Copy link
Copy Markdown
Member

Thank you for this contribution, @NikitkaRa! It has landed on main and will ship in the next DeckCraft release.

If you haven't already, please come join us on Discord: https://discord.gg/artcraft

anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…text (storytold#384) (storytold#472)

Replacing text in a serif line (Times New Roman, say) with Cyrillic failed
with "Japanese fallback font has no glyph for U+0444". The Type 3 fallback
took only the style's first face, Shippori Mincho, which has no Cyrillic,
although BIZ UDMincho and BIZ UDPGothic ship alongside it.

`document_japanese_fonts_for_style` lists every Japanese face in the
existing order of preference, and `type3_font` uses the first one that has
a glyph for every character. If none has them all, the preferred face still
names the missing character, as before.
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.

[Audit] Animation trigger preprocessing is quadratic before the effect limit can stop it

3 participants