FORUMS: list search recent posts

Expression for adding an explanation point to a text layer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
David Mathis
Expression for adding an explanation point to a text layer
on Dec 3, 2013 at 7:23:36 pm
Last Edited By David Mathis on Dec 3, 2013 at 8:35:04 pm

I am needing to know how to add some form of punctuation to the end of a text layer when a certain number is reached. For example I have a counter expression (see below) and when it reaches something like ten I want to add in the punctuation to the end of the text layer. The text will be based upon the counter created with a slider control. I have tried this only to get some error message. I assume that the expression considers the expression itself as some type of equation resulting in the error message.

I want to keep the layers to a minimum if possible. I did find that if I made two text layers that I could accomplish my goal without getting an error message. The first text layer did have the source text linked to a slider control that does the counting. The second text layer had its source text linked to first text layer. There it was possible to use the expression I wanted. I could be missing something simple here and might be making things more complicated than they need to be.



Thank you for having this forum!

Name of the text layer is subscription counter
The expression slider control is counter

Expression for slider control:
Math.abs(effect("Counter")("Slider")) // This is the counter
Math.abs(effect("Goal")("Slider")) // This is the goal


Expression for source text:
text = effect("Counter")("Slider");
goal = effect("Goal")("Slider");
if (text == goal)
{ [ text+"!"] }
else
{ [ text ] }

Using the above expression I get an error message that says, "Divide by zero?"


Return to posts index

Kevin Camp
Re: Expression for adding an explanation point to a text layer and turning checkbox on
on Dec 3, 2013 at 8:48:24 pm

try this
txt = effect("Slider Control")("Slider").value;
goal = effect("Slider Control 2")("Slider").value;

if (txt == goal) txt+"!" else txt


and for the checkbox expression, change the last line to:
if (txt == goal) true else false

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW


Return to posts index

David Mathis
Re: Expression for adding an explanation point to a text layer and turning checkbox on
on Dec 3, 2013 at 10:08:37 pm
Last Edited By David Mathis on Dec 3, 2013 at 10:10:16 pm

Thank you! One more basic question, as I am fairly new to expressions and that would be using a layer control expression to control which text layer is on and the others are off. I have a null object with various expression controls one of them is a layer control. For example, should I choose layer two, which is a text layer, I want that layer to be at full opacity and the others off. Provided below is an example, where the question mark represents where I am confused. Thank you for taking your time to answer our questions and thank you to the Cow team for having this forum.

layer = thisComp.layer("Goal").effect("Layer Control")("Layer");
if (layer==?) 100
else 0

The number two would indicate that layer 2 was selected and this is the one that I want to see.
The expression is applied to the opacity of the text layer.


Return to posts index


Dan Ebberts
Re: Expression for adding an explanation point to a text layer and turning checkbox on
on Dec 3, 2013 at 10:16:04 pm

I'd do it this way:


try{
layer = thisComp.layer("Goal").effect("Layer Control")("Layer");
if (layer.index == index) 100 else 0
}catch (err){
0
}



Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]