Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for animating CATransform3D #39

Conversation

NickEntin
Copy link
Collaborator

This adds conformance for CATransform3D to AnimatableProperty by decomposing the two matrices into their respective components, interpolating the values in the decomposed transforms, then recomposing the interpolated value into a CATransform3D. This follows the same pattern we use to interpolate CGAffineTransform.

Resolves #19.

This adds conformance for CATransform3D to AnimatableProperty by decomposing the two matrices into their respective components, interpolating the values in the decomposed transforms, then recomposing the interpolated value into a CATransform3D. This follows the same pattern we use to interpolate CGAffineTransform.
@NickEntin
Copy link
Collaborator Author

I also tried a version of this using simd types, but it had worse performance (by ~15%).

@NickEntin NickEntin force-pushed the entin/catransform3d-animatable-property-decomposition branch 3 times, most recently from 4f3b195 to d8f24da Compare August 15, 2020 04:08
@NickEntin NickEntin force-pushed the entin/catransform3d-animatable-property-decomposition branch from d8f24da to 7d57edf Compare August 15, 2020 23:47
@NickEntin NickEntin requested a review from seanho August 17, 2020 02:56
Copy link
Collaborator

@seanho seanho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand most of the math stuffs in there, just reviewing the change set as is and code looks good. The test snapshots are very useful and cool, one suggestion, if we can make the red block different color on each side, it will make the rotation/perspective snapshot animation more obvious.

Sources/Stagehand/Utilities/Vector4.swift Outdated Show resolved Hide resolved
@NickEntin
Copy link
Collaborator Author

one suggestion, if we can make the red block different color on each side, it will make the rotation/perspective snapshot animation more obvious.

That sounds like it would be super helpful, but as far as I know CoreAnimation doesn't support this. Layers are really 2D objects in a 3D world, so there is no "back side" to the layer.

@NickEntin
Copy link
Collaborator Author

as far as I know CoreAnimation doesn't support this

Chatted offline. I misunderstood what the suggestion was. Commit coming shortly to address this.

@NickEntin
Copy link
Collaborator Author

So... the last segment of the shear interpolation test looks really weird. But it's actually doing the right thing. I'll replace it with a better example.

@NickEntin NickEntin merged commit 870b421 into cashapp:master Aug 20, 2020
@NickEntin NickEntin deleted the entin/catransform3d-animatable-property-decomposition branch August 20, 2020 07:07
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.

Make CATransform3D conform to AnimatableProperty
2 participants