Skip to content

feat: Route the transform CSS transition to Core Animation on iOS#9692

Draft
MatiPl01 wants to merge 2 commits into
mainfrom
@matipl01/css-transform-on-platform-values
Draft

feat: Route the transform CSS transition to Core Animation on iOS#9692
MatiPl01 wants to merge 2 commits into
mainfrom
@matipl01/css-transform-on-platform-values

Conversation

@MatiPl01

Copy link
Copy Markdown
Member

What

Adds native iOS Core Animation support for the transform CSS transition property. transform (and transform-origin) now animate on the render server through an additive Core Animation stack instead of the C++ loop, matching the loop's output. Cases Core Animation cannot express - percent translates, perspective, and steps / linear-stops easings - keep running on the loop.

Builds on #9654 (platform-routed CSS transitions).

How it works

  • All preprocessing and per-transition state live in common C++ (CSSPlatformTransitionProxy): endpoint resolution, the transform-origin bake, reverse-shortening, in-flight sampling and plan building.
  • The platform layer is thin: it receives a finished, platform-agnostic TransformAnimationPlan and only orchestrates Core Animation (animateTransformForTag:plan:). No view, layout or interpolator state crosses the boundary.
  • transform-origin is baked into the plan as Translate(+offset) * M * Translate(-offset), mirroring RN's BaseViewProps::resolveTransform.
  • Android keeps using the loop (no native path today), so the plan is the cross-platform contract a future Android implementation can consume.

Testing

Verified on device (iPhone 16 Pro simulator) by running each transition on Core Animation (red) next to the loop (blue) and measuring per-frame box centroids: they track within a couple of pixels across rotate / scale / translate / skew, multi-op stacks, transform-origin corner pivots and mid-flight reversal.

Comparison recordings

CA (red) vs loop (blue) - rotate + scale about the top-left origin:

drag rf_min.mp4 here

Mid-flight reversal (reverse-shortening):

drag rfrev_min.mp4 here

Routes the transform CSS transition property to iOS Core Animation (rotate, scale, translate, skew, transform-origin), falling back to the C++ loop for cases CA cannot express (percent translates, perspective, steps/linear-stops easing). Transform preprocessing and per-transition state live in common C++; the platform layer receives a finished TransformAnimationPlan and only orchestrates Core Animation.
@MatiPl01 MatiPl01 self-assigned this Jun 17, 2026
The reverse-add order matches the loop empirically (pinned down on device), not via a documented Core Animation contract; flag it for future maintainers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant