-
Separating expressions using .text.sourceText
Hey Everyone,
I am new to writing expressions, too which I’m slowly building on.
I’ve been playing with an expression that allows me to rig the source text so I can use the editable text feature in Premiere from After effects.
input = thisComp.layer(“[Colour]”).text.sourceText;
if( (input == “red”) | (input == “Red”) | (input == “RED”) == 1 ) value else 0;
I’ve been finding it quite useful, as I have to normally build 9 different colours that correspond to 5 different stations. When I have to create any network promos, It takes a huge chunk of time to swap, replace, duplicate. I have reduced it to two comps “Station” and “Colour”, I type in a the station and colour and wallah.
But I want to reduce it to one comp, because I have to have transparency for a background image, which if I precomped I know would still work. The issue is I have the choice of selecting a colour or selecting what percentage of the transparency I want. I can’t mix the two together.
If I put this underneath the above expression.
txt = thisComp.layer(“Opacity”).text.sourceText.value;
n = parseFloat(txt);
if (isNaN(n)) value else n;It over rides the above and I can’t change the colour, but if I have it above. I can change the colour, but can’t alter the opacity.
This is where I’m struggling…How can I use both of these expressions in the Opacity of my layer, and have them assigned to two separate text layers and simultaneously work.
I would ask if there was a way instead of using parseFloat to affect the opacity, but to ask it to change it’s blendmode instead would be awesome, but it appears through what I’ve read…That it can’t be done. Instead what I want to do, being able to play with the opacity between 50-75% would be good enough and save me hours when it comes to building 20 promos at a single time.
input = thisComp.layer("[Colour]").text.sourceText;
if( (input == "red") | (input == "Red") | (input == "RED") == 1 ) value else 0;txt = thisComp.layer("Opacity").text.sourceText.value;
n = parseFloat(txt);
if (isNaN(n)) value else n;