Skip to content

Feat: Add Spring timing and 3D matrix animation (CR-8a, FR-41.2, FR-41.2.1) - #966

Merged
b-re-w merged 20 commits into
developfrom
feat/cr8a-additive-vocabulary
Nov 26, 2026
Merged

b-re-w merged 20 commits into
developfrom
feat/cr8a-additive-vocabulary

Conversation

@b-re-w

@b-re-w b-re-w commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Second of two stacked pull requests. Based on #972 (feat/cr8a-neutral-buttons-counts); the diff against it is the animation half only.

Size: about 1790 changed lines with generated files and the staged Android copies excluded (about 2420 with the copies). It is not split further because Spring and Transform3D share the timing table, the keyframe encoder and the Kotlin animator (RendererAnimations.kt); the leader approved this.

Existing tests touched:

  • transform_animation.rs and ProtocolVectorsTest.kt: the vector's animation count goes from 10 to 12, and the border colour check reads the third record from the end, because the spring and the matrix come after it.

New tests: fr41_spring_timing_round_trips, fr41_spring_with_invalid_parameters_is_a_protocol_error, fr41_spring_spec_duration_is_the_settle_time, fr41_spring_alpha_is_clamped_while_it_overshoots, fr41_2_1_transform3d_animation_round_trips, fr41_2_1_transform3d_animation_needs_its_base_modifier, fr41_2_1_transform3d_animation_writes_the_interpolated_matrix, fr41_2_1_transform3d_animation_draws_without_recomposition, fr41_2_1_a_transform3d_record_that_cannot_be_played_is_a_protocol_error, fr41_compose_api_animates_a_3d_matrix, AnimationSpringMatrixTest.kt.

Left open: dioxus-compose needs arms for Timing::Spring, KeyframeValue::Matrix3D and AnimatedProperty::Transform3D on its pin bump (DX-2 owns the Host half of DarkPyonix/dioxus-compose#46); the rsx Modifier gets no transform3d here, by the leader's decision.

The full gate runs again at this pull request's schema LOCK turn, after #972 merges and develop is merged in; the result goes here.

Closes #552
Refs DarkPyonix/dioxus-compose#46

Adds TimingKind::Spring = 4 and Timing::Spring { stiffness, damping_ratio }.
The keyframe keeps its 24 byte head: p1 is the stiffness, p2 the damping
ratio, p3, p4 and the step position are zero. Both decoders refuse a
stiffness or damping ratio that is not finite and positive, and anything in
the unused fields.

The Renderer eases a spring segment as Compose's SpringSimulation from 0 to 1
at t = u * T, where T is Compose's estimateAnimationDurationMillis with a
visibility threshold of 0.001, ported step for step. T is worked out once per
keyframe when the animation arrives, so a frame allocates nothing, and the
curve is exactly 1 at u = 1. An overshooting alpha and colour are clamped by
the paths that already clamp an overshooting cubic-bezier.

AnimationSpec::spring fills duration_ms with the same settle time
(spring_settle_ms), so the default length moves at Compose's speed.

The mutation vector gains one spring record after every existing record.
Generated files (Protocol.gen.kt, vectors, schema hash) are left for the
codegen run.

Tests: fr41_spring_timing_round_trips, fr41_spring_with_invalid_parameters_
is_a_protocol_error (Rust and Kotlin), fr41_spring_spec_duration_is_the_
settle_time and fr41_spring_settle_time_matches_the_host_table (S3, same
table), fr41_spring_easing_matches_compose_spring (S2),
fr41_spring_alpha_is_clamped_while_it_overshoots (S4).
…#46)

Adds AnimatedProperty::Transform3D = 6 and KeyframeValue::Matrix3D([f32; 16]),
column-major like the Transform3D modifier: a 64 byte value, an 88 byte
keyframe. Both decoders refuse a value that is not finite and a record with
an origin of its own, because the origin and backface-visibility are the base
modifier's. The Renderer refuses, once the batch is in, a Transform3D
animation on a node without a Transform3D modifier, and a Transform
animation on a node that has only one.

The Renderer interpolates as CSS Transforms Level 2 does: both ends are taken
apart into translation, scale, skew, perspective and a quaternion, the parts
are interpolated (the quaternion by slerp) and put back together; a singular
end switches at progress 0.5. The decomposition works in scratch made once,
and Transform3DPlan.solve no longer allocates, so a frame allocates nothing.

A node whose Transform3D is animated draws through one fixed layer shape
(affine layers outside, a perspective layer inside) whose blocks read the
animated matrix and solve the plan again in the layer phase, so playing it
neither recomposes nor remeasures the node and hit testing follows the shape.
from_presented starts from the matrix shown.

The Rust authoring API takes a Matrix3D keyframe through transition(). The
mutation vector gains one Transform3D record after every existing record.
Generated files are left for the codegen run; android-kotlin is re-staged.

Tests: fr41_2_1_transform3d_animation_round_trips (Rust and Kotlin),
fr41_2_1_transform3d_animation_needs_its_base_modifier (Rust decoder and
Kotlin table), fr41_2_1_a_transform3d_record_that_cannot_be_played_is_a_
protocol_error, fr41_2_1_matrix_interpolation_follows_css_transforms_2,
fr41_2_1_transform3d_animation_writes_the_interpolated_matrix,
fr41_2_1_transform3d_animation_draws_without_recomposition,
fr41_compose_api_animates_a_3d_matrix.
…(FR-21.2.4)

An absent Count was written as a clear on a freshly created node, and a count of 0 is a count, so Count gets its own tracking bit: only None is neutral.
….2.4)

The fixture replied to every event, including the reports the Renderer sends at start, so the count had already changed before the test took its baseline.
…OutlineVariant (FR-22.2)

OutlineVariant equals SurfaceVariant in Material's dark scheme, so it cannot
separate the two tiers.
…600)

OutlineVariant equals SurfaceVariant in Material's dark scheme, so the two
tiers came out the same grey and fr22_2_neutral_button_tiers_carry_no_accent
failed.
Conflicts only in generated files (Protocol.gen.kt twice, schema-hash.txt,
vectors.json); this side is kept here and the next commit regenerates them.
…unt Agreed (FR-41.2, FR-41.2.1, FR-21.2.4)

The leader approved 0de4205 and 2321316 on 2026-11-22.
…I half)

Makes feat/cr8a-neutral-buttons-counts an ancestor, so this branch's diff against it is the animation half. The tree does not change: every commit on that branch is already here.
@b-re-w b-re-w changed the title Feat: Spring timing, 3D matrix animation, neutral button tiers and destination counts (CR-8a) Feat: Add Spring timing and 3D matrix animation (CR-8a, FR-41.2, FR-41.2.1) Nov 22, 2026
@b-re-w
b-re-w changed the base branch from develop to feat/cr8a-neutral-buttons-counts November 22, 2026 05:10
…-vocabulary

# Conflicts:
#	compose-rust/android-kotlin/shared/Protocol.gen.kt
#	compose-rust/schema-hash.txt
#	compose-rust/tests/vectors/vectors.json
#	renderer/desktop/src/protocol/Protocol.gen.kt
…-vocabulary

# Conflicts:
#	compose-rust/src/codegen.rs
#	compose-rust/tests/vectors/mutations.bin
b-re-w added a commit that referenced this pull request Nov 25, 2026
… (provisional)

One regeneration over develop with #965 and #966 merged, to check the merge
before #1057 joins the turn. The final regeneration of the turn replaces it.
Schema hash 0x9f4cb485d33b628b; tables_hash 0xec93_c466_6e16_7d5e.
b-re-w added a commit that referenced this pull request Nov 25, 2026
, #972, #966, #1057)

One regeneration over develop with the six PRs merged. Schema hash
0x048ae5f51d77b280; 162 properties; tables_hash 0xec93_c466_6e16_7d5e; the
event vector is 55 records, 2062 bytes.
@b-re-w
b-re-w changed the base branch from feat/cr8a-neutral-buttons-counts to develop November 26, 2026 18:53
@b-re-w
b-re-w merged commit fd37108 into develop Nov 26, 2026
@b-re-w
b-re-w deleted the feat/cr8a-additive-vocabulary branch November 26, 2026 18:53
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