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

Core Animation rendering engine doesn't support MatteType.invert #1655

Closed
centralmotion opened this issue Jul 19, 2022 · 6 comments · Fixed by #1712
Closed

Core Animation rendering engine doesn't support MatteType.invert #1655

centralmotion opened this issue Jul 19, 2022 · 6 comments · Fixed by #1712

Comments

@centralmotion
Copy link

centralmotion commented Jul 19, 2022

Which Version of Lottie are you using?

Lottie 3.4.0

Issue

Hello there! I was experimenting with 3.4.0 (Core Animation) on iOS and I noticed that animated track matte layers do not seem to animate when tested with 3.4.0

I am exporting with Bodymovin V 5.9.0

Animated mattes may not be supported yet, I am not sure if this is the case!

Thank you for all your efforts! Looking forward to using 3.4.0!

Animation JSON

https://lottiefiles.com/113328-square-matte-test
Here is a test that I used to troubleshoot.

@calda
Copy link
Member

calda commented Jul 19, 2022

Thanks for the report! Interestingly it looks like the main thread engine and core animation engine are both incorrect here 😆

Main thread engine, and .automatic option Core Animation engine
2022-07-19 12 09 17 2022-07-19 12 09 27

The main thread engine renders the matte correctly, but doesn't animate the star shape. The Core Animation engine animates the star shape, but doesn't render the matte correctly.

Since .automatic and .mainThread both render the same as Lottie 3.3.0 and earlier, I wouldn't consider this a bug. There are two useful related enhancements though:

  1. support the type of matte layer in the Core Animation rendering engine
  2. support matte animations in the Main Thread rendering engine (may not be necessary once this animation is fully supported by the Core Animation engine).

@calda calda changed the title Track Matte rendering without animation. Core Animation rendering engine doesn't support MatteType.invert Jul 19, 2022
@centralmotion
Copy link
Author

Thank you for the detailed reply! Which type of Matte should I choose when using animation in the Core Animation rendering engine?

@calda
Copy link
Member

calda commented Jul 19, 2022

I think Core Animation may not support using entire layers as inverted masks, so it may not be possible to implement this using a Matte layer.

If you need to use an inverted mask, you could potentially use a Mask instead. Since those masks include a bezier path, we can invert it without any issues (supported as-of #1617).

@centralmotion
Copy link
Author

Thanks again @calda for the support. You are awesome!

@centralmotion
Copy link
Author

@calda Just as a follow up I was able to link the mask of a layer to a rig I made with the 'Create Nulls From Path' script in After effects, set it to subtract and it worked!

@calda
Copy link
Member

calda commented Jul 19, 2022

Cool! Thanks for sharing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants