
- #Ae expressions mactracker how to#
- #Ae expressions mactracker code#
- #Ae expressions mactracker plus#
For example, the blinking box below has an if statement that says if it’s rotation is greater than 180 than the value should be 0. One of the most useful applications of an If/Else statement in After Effects is to have an object’s opacity directly linked to another type of value. There are a number of different reasons why a motion graphic designer might want to use If/Else statements in After Effects. How Can I Use If/Else Expressions in After Effects? In our example, if the opacity value of the shape was not greater than 50 (false) than the opacity of the text would be 50. The false value pertains to the value that will be output if the “if” statement isn’t true. Define the ‘Else’ StatementĪn else statement will define a value if the “if” statement is false. Write: Else 8. Look at the example again…if the value of the square was in fact more than 50 (true) than our output value would be 100. Type in the value you want your expression to output if your conditional statement is true. In our example the conditional value was 50.

The conditional value can be any number you want. However, if you want to learn more check out the If/Else Conditional post at. Due to their complexity we will cover those in a later post.

Note: There are also more complex operators called “logical operators”. įor the above example we will use the greater than (>) operator. The following chart explains what equality operators you can use in After Effects. Set Your Equality OperatorĪn equality operator is essentially a small formula designed to tell your expression what to do. So in that example we would pickwhip to the opacity of the white shape. For the example above, the input value came from the opacity of the white shape. Using the pickwhip tool select the value you want to input into your If/Else statement. What do each of the parameters in this expression mean? Let’s break them down step by step: If(thisComp.layer(“WhiteShape”).transform.opacity>50) 100 else 50 The expression used in the example above is: Simply open up your expression editor by holding down Option and clicking on the stopwatch next to the parameter you want the If/Else statement to effect. Writing an If/Else statement is fairly straight forward.
#Ae expressions mactracker how to#
How to Write an If/Else Conditional Expression Here’s what our After Effects timeline looks like for this example: If the white squares opacity is less than 50% the text opacity will be 50%.
#Ae expressions mactracker code#
In this example, the code states that if the white shape’s opacity is more than 50% than the text opacity will be 100%.

Let’s take a look at a really basic model: If this sounds confusing, don’t worry! It’s simplier than you might think. What is an If/Else Expression in After Effects?Īn If/Else expression in After Effects is a line of code that will change it’s output value based on the input value. You don’t have to be a computer programmer to get a handle on expressions in After Effects. Let’s dig into the powerful If/Else expression in After Effects. If (L.If/Else expressions are incredibly useful in After Effects…if you know how to use them. L = thisComp.layer("MyTextLayer") // text layer whose size must be evaluated step = 1.0 // higher values speed things up (2 means two times faster) but reduce precision In case the link dies, here is the complete expression they use to determine the bounding box.
#Ae expressions mactracker plus#
So you want the width of the whole text object no single characters?Ī tutorial plus sample project on how to get the bounding box of a text layer. Is there a JS method that can get the size of a string on screen? There seems to be several solutions for this when the client is a web browser, but I can't find any that work for AE expressions. so I'm trying to find a string method that I could use like this: xOffset = thisComp.layer(1).(1, theOffset).getTextWidth()īut getTextWidth obviously isn't a valid method.

…but this relies on me going through and creating keyframes to match the spacing of all the letters in the text, and frankly I'd rather be doing something else with the time that takes. If (thisComp.layer(1).(theOffset, 1) = " " )//effectively hide it on errors (like the index going out of bounds) It's very tedious animating the position of the bottom layer to match the text, so I'm wondering if it's possible to use any javascript tools to measure the characters and drive the position value.Ĭurrently I have an expression driving the opacity like this, to automatically turn the background off for spaces: theOffset=thisComp.layer(1).text.animator("Animator 1").selector("Range Selector 1").offset I have a type effect that requires a couple of layers, one with the type, and another moving behind the letters as they appear (simulating the little text bubbles you get when typing on an iPhone).
