How can I get masks to work in Lottie?

I can’t resolve the issues with masks in After Effects.

Everything is playing as it should in After Effects, but when I preview or export the Lottie, the masks aren’t there.

I can’t figure it out. Any advice would be much appreciated.

1 Like

Are you using shape/vector layers or pixel layers?
If pixel layers is what your comp is you have to export the image sequence and import it into a fresh comp, then export with the include assets options on inside the configuration menu.
Try with export guides on as well.
I hope it works

Hi, I’m having the same problem. Masks are rendering in ae, but are not present in Lottie preview. I’m not fully understanding the solution above. I looked everywhere for a solution for this and still haven’t found anything that works. Does anyone know how to make masks work in ae/Lottie?

1 Like

Having the same issue. It worked 2 weeks ago when I tried with a different comp.

I ended up making a pre-comp and masking in the comp and that fixed it. Not sure why it matters where the mask is, but it worked!

3 Likes

What I do is create shape layers on top of each illustrator layer and then alpha mask to the shape layer. I’ve also been playing with animating paths on the shape layers to fine-tune my masks.

4 Likes

Try @natelubeck method this work even while previewing and after exporting and implementing. I use this method only. But do not apply “Luma” matte, it does not work.

1 Like

Only alpha mattes and alpha inverted mattes are supported right now

Have you worked with track mattes often? Have you worked with alpha inverted track mattes?

Hey there, I see that alpha mattes and inverted mattes are supported for most but not all situations.

Do you usually just use Alpha Mattes or Alpha Inverted Mattes anyways? thanks!

1 Like

This is good to be aware of. Although it’s worth mentioning that alpha inverted mattes do have a display issue rendering on the LottieFiles iOS app. Even though they are supported for iOS. I can confirm it’s a bug on the iOS app and that alpha inverted mattes do indeed work on iOS

1 Like

Something I encountered was that I was not exporting hidden layers. Of course my mask was hidden, so after enabling export hidden layers it worked.

2 Likes

Can you go into more detail on your process? I’m putting a shape layer between the precomped image and the mask above it, and messing with all of the mask settings and the closest I got was to get the images to be masked OUTSIDE the area that I actually want them to show up in.

Have you tried to do this without Precomposing? It generally works best if you keep everything within the same COMP especially with masks/

Thanks irby, I think I figured out the simple way to mask that works, I didn’t know to stay away from precomping, though in something simpler I did precomp a lot and it works, it just makes sense with complex objects to precomp so I’ll have to watch how I mask from the getgo. Thanks

1 Like

Now you can use the mask effects on Lottie Animation, I found the solution in this video

I considered impossible to make animations using masks because Lottie doesn’t support them, but masking a Pre-comp does work. Thanks so much for sharing this solution :heart:

You saved me a lot of headaches. Thanks. Alpha inverted on solid then connected to shape layer worked for my requirements

1 Like

If someone in 2024 or later is having trouble with masks in Lottie:

After Effects used to behave differently and it’s messing up your export.
Today, you can set any layer as another layer’s Track Matte, essentially masking it.
In older versions, only the layer directly above yours in the hierarchy could be a Track Matte (an Alpha Matte, back then). Lottie STILL behaves that way, despite the update.

What does this mean?
If you want to use Layer A as a mask for Layer B, it has to be positioned directly above Layer B. It still works if the layer is hidden, so if you need them to be in a specific order, you can duplicate them and hide the copies.

Once your masking layers are all placed directly above their masked counterpart, the Lottie export should show them properly.