Skip to main content
Inspiring
July 10, 2024
Question

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

  • July 10, 2024
  • 1 reply
  • 194 views

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 has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
July 11, 2024

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.