$.build – returns the build of After Effects,.This page does mention the $ object and notes that there are three supported uses, No one else is going to understand your expressions, they’ll probably think you’re dabbling in the dark arts.This can cause weirdness and means that you could accidentally delete a variable that you’re using in another layer and it will keep working until the next time you open up the project, when it will be mysteriously broekn. variables persist when they’re deleted or renamed.A trivial example: $.compTime = function() If you want to use time you’ll have to use it in a function. The value of $.myVar in that code is set at the point the expression is evaluated, and not refreshed when the playhead moves. If you use an expression like $.myVar = time you would expect $.myVar to equal the current time of the composition.So changing your layer order might break stuff. If you want to add something to the $ global object you need to do it on the top layer, or it may not get evaluated before it is called. This is a rather experimental approach, and may get patched out of existence in updates of AE, so don’t rely on it to fly your aeroplane or run your nuclear weapons system.This is a massive time saver for procedural animation where you might have scads of layers with hard-to-get-at properties controlled by expressions. If I change the expression on the red solid they will all update their behaviour instantly without me having to copy and paste new expressions. So as you can see each layer is evaluating the function separately to achieve different results-but they’re all using the same function. Similarly the random number is different on each one because the seed is foo.index, which evaluates differently on each layer. Any function that uses properties of a layer needs to be explicitly told what layer it’s referring to. This is necessary because if we just used index as demonstrated by the next line, it returns the index of the layer where the function is defined. In the text layer the variable foo is assigned the value thisLayer which is a reference to the text layer itself. The parameter foo is expecting a reference to a layer (I should have named it better, I know) and returns a string with: the index of the layer referred to by foo (specified by foo.index), the index of the layer where the function is defined (just index), and a random number. ", random: " + Math.round( Math.random(index* 100)) ![]() So on the solid layer we have this expression: Here’s an example: the source text of the text layer is controlled by a variable on the solid layer. And since it’s Javascript we can just hot-glue properties and methods on to it whenever we like. So what is $ actually good for? Think Globallyīecause $ is a global object, it’s available to all expressions. In the scripting world, for example $._ADBE_LIBS_CORE.getCurrentUser gives you all sorts of data about the current user’s Creative Cloud account. I’ve been researching the $ object and its members, but apart from accidentally discovering that there’s a blink() function for strings (hilariously it works, but not in the way that anyone who ever had a geocites account thinks), I haven’t found too much to get excited about. But it also appears to be available for use in expressions. $ is a mysterious “Helper Object” that is available to extendscript and used to do things like find the current version of the application, or what the user’s name is. And it turns out that $ can bring you happiness… ![]() One of the undocumented expression language feature in After Effects is the global object, also known as $.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |