Commit 0ce65d9
authored
fix(animation): make every animated property reach layout and the frame (#443)
* fix(animation): make every animated property reach layout and the frame
Two issues, one architecture. #426 reported that an animation touching
only border_radius, clip_path_progress or font_size never applied; #430
reported letter_spacing having no effect on rich_text and gradient_text,
animated tracking overflowing because layout used the static value, and
a static opacity: 0 cancelling a fade-in. Three separate defects sat
behind them.
props_has_paint_overrides gated whether apply_animated_props ran at all.
It listed translate, scale, rotation, opacity, blur, glow, perspective,
width and height, and had gone stale against every property added to
AnimatedProperties since. The gate is deleted rather than completed:
apply_animated_props already guards each branch against the resting
value, so the list bought nothing and left the same trap for the next
property anyone adds.
with_cascaded_style folded the box's own resolved style onto a clone of
the same component through inherit_from, which only fills fields that
are None. A component declaring its own font-size or letter-spacing
therefore never saw the animated value. inherit_from is right for what
it is named after -- parent to child -- so the re-cascade gets its own
function, overlay_resolved_typography, which overwrites. Conflating the
two was the bug.
rich_text ignored style.letter-spacing outright, static or animated:
compute_layout discarded the resolved value into a binding named
_letter_spacing_unused and resolve_span_fonts defaulted every span to
0.0. Neither fix above would have reached it.
An animation on opacity now replaces the declared static value instead
of multiplying with it, which is how every other property in
apply_animated_props already treats its declaration. This changes the
render of a scenario that declares an opacity and animates it: a node at
opacity 0.6 with a pulse used to paint 0.6 * pulse and now paints the
pulse. Effects still compose with each other -- that happens upstream in
AnimatedProperties::merge and is untouched.
Closes #426
Closes #430
* test(cascade): call with_cascaded_style the way the render path calls it
with_cascaded_style had two meanings depending on who called it. The
render path passes the node's own already-resolved style, where
overwriting is right because that style has already applied the
component's own declaration over its parent's. These two tests passed it
a bare parent style instead, where filling only the gaps was right.
Making the function overwrite fixed the first caller and broke the
second, which is what turned table_own_color_wins_over_cascaded_card_color
red on CI while every local scoped run stayed green.
The invariant both tests assert is unchanged and still worth asserting.
They now build the resolved style the box tree builds -- the component's
own, with inherit_from filling what it left unset -- and pass that, which
is the shape the render path actually uses.1 parent 51546a0 commit 0ce65d9
6 files changed
Lines changed: 775 additions & 35 deletions
File tree
- crates
- rustmotion-components
- src
- tests
- rustmotion-core/src/css
0 commit comments