• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is it possible to use expressions to change what layer is being used as a track matte?

Community Beginner ,
May 19, 2023 May 19, 2023

Copy link to clipboard

Copied

Allow me to explain what I'm asking.


My end goal is a MOGRT that is easily customizable for others to use. For simplicity sake, lets say this MOGRT has five layers, one is a textured background, one has a media element, and one is a semi-transparent overlay. I also have two layers that contain shapes on them that I am using to mask each of the overlay and the media element layers over the background.

Where I am having issue is that, in order to add more variety and  usefulness to this MOGRT I've created new mask (tracking matte) layers with different shapes to them. Lets say the first mask shape was a triangle this new shape might be an oval.

I'd like to set up a dropdown in my MOGRT that lets me swap which of the mask shapes are being used on the two layers that I need to mask.

Is this possible to do with an expression? If not, does anybody have  any ideas of an alternate solution to achieve this effect? My actual file is a bit more complex than what I've described, but the gist of it is the same.

 

Thank you for your time.

TOPICS
Expressions , How to

Views

223

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , May 19, 2023 May 19, 2023

Couldn't you have the shapes in a precomp, use the precomp as the track matte, and use experssions to control the opacity of the individual shapes?

Votes

Translate

Translate
Community Expert , May 19, 2023 May 19, 2023

I do exactly what Dan is talking about. I don't even pre-compose the shape layers. I've set a dropdown menu controller and just written simple if(ctrl == 1) 100 else 0 for the fill opacity of the shape layers. I just name them in the Extended Graphics panel and assign the numbers in the Fill/Opacity expression. That's all there is to it. 

 

Something like this:

sel = effect("Selet Matte")("Menu");
if (sel == 1)
	100;
else
	0;

Change the equals value to match the number of the Opacity property, a

...

Votes

Translate

Translate
Community Expert ,
May 19, 2023 May 19, 2023

Copy link to clipboard

Copied

Couldn't you have the shapes in a precomp, use the precomp as the track matte, and use experssions to control the opacity of the individual shapes?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 19, 2023 May 19, 2023

Copy link to clipboard

Copied

I do exactly what Dan is talking about. I don't even pre-compose the shape layers. I've set a dropdown menu controller and just written simple if(ctrl == 1) 100 else 0 for the fill opacity of the shape layers. I just name them in the Extended Graphics panel and assign the numbers in the Fill/Opacity expression. That's all there is to it. 

 

Something like this:

sel = effect("Selet Matte")("Menu");
if (sel == 1)
	100;
else
	0;

Change the equals value to match the number of the Opacity property, and you get this:

RickGerard_0-1684568285522.gif

 

 

I've even created linear interpolation methods that fade in and out of various track mattes and even shape layer backgrounds based on the time minus inPoint and time minus outPoint of a layer. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 20, 2023 May 20, 2023

Copy link to clipboard

Copied

LATEST

Dan and Rick are right... but just in case you were wanting to expand your question to layers where you might want to use more than a simple shape, then you can use the Set Matte effect for each of the selectable layers.  In the effect's Compositing Options, you can apply an expression on each, much like Rick's.  Using two Set Mattes here would give you options like including a smoke video or similar.

helped.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines