Skip to main content
Inspiring
Jul 10, 2024 11:01 AM UTC
Question

How to fill shapes with different images without creating hundreds of layers?

I want lots of the same shape to appear but with a different country's flag in each one. Is there so expression magic that can randomize the flag image that fills each shape?

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Dan Ebberts
Community Expert
Community Expert
Jul 11, 2024 6:29 PM UTC

Not sure I understand completely, and I may be a little out of my lane, but this sounds like a good application for Essential Graphics. You would create a precomp named ("Flags") that has all your flag images with a null named "control" at the bottom of the layer stack. You'd add a slider to the null and an opacity expression like this to each of the flag layers:

thisComp.layer("control").effect("Slider Control")("Slider") == index ? 100 : 0

Then you'd add the slider to the Essential Graphics panel. Then you'd create a new comp and drag the Flags precomp in as a layer. Twirl open the Essential Properties and add this expression to the Slider Control:

numFlags = comp("Flags").numLayers-1;
1 + Math.floor(random(numFlags))

Then add your star shape as a mask or track matte.

Duplicate the comp in the Project panel and you should get a random flag in each copy. Hope that helps.

Translate