Skip to main content
Participant
March 28, 2014
Answered

Expression for image replacement depending on text layer text.

  • March 28, 2014
  • 1 reply
  • 1868 views

Hello, i wanted to ask is it possible to replace image in composition depending on text layer text. I.E. text layer contains code ##34 and expression tells what kind of image should be placed depending on if conditions in image expression.

Sincerely, Deimantas

This topic has been closed for replies.
Correct answer UQg

Hello,

Expressions can't add/replace images.

All images should be there somewhere, as layers, either in the comp or in a precomp, but not just as items in the project panel.

Then you can play with the opacity of these layers, by putting an opacity expression on each of them:

textLayer = (pickwhip the Text Layer that carries the info);

if (textLayer.sourceText == thisLayer.name) 100

else 0;

The condition can be something different, for instance "if (textLayer.sourceText == thisLayer.index)", etc, etc.

Not clear what should be that condition in your case.

Xavier.

1 reply

UQg
UQgCorrect answer
Legend
March 28, 2014

Hello,

Expressions can't add/replace images.

All images should be there somewhere, as layers, either in the comp or in a precomp, but not just as items in the project panel.

Then you can play with the opacity of these layers, by putting an opacity expression on each of them:

textLayer = (pickwhip the Text Layer that carries the info);

if (textLayer.sourceText == thisLayer.name) 100

else 0;

The condition can be something different, for instance "if (textLayer.sourceText == thisLayer.index)", etc, etc.

Not clear what should be that condition in your case.

Xavier.

UQg
Legend
April 13, 2014

Update...: for still images, there is a much much better way to do it, as explained in this thread: http://forums.creativecow.net/thread/227/26632#26645

(see Darby Edelen's answer).

Xavier.