ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

AE Expressions: Refercing a code block

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sven Flesch
AE Expressions: Refercing a code block
on Jan 3, 2012 at 6:52:12 pm

I have a block of code that needs to run in multiple layers. So far I'm copy and pasting. That's bad enough. However, when I change the code I need to go through all the layers and make the change or re-paste it. A better solution would be to reference the entire block of code from a single location or an extra layer that just contains the code. Is that possible in AE?


Return to posts index

Dan Fredley
Re: AE Expressions: Refercing a code block
on Jan 4, 2012 at 1:32:56 am

You can store basic expressions in layer names and use eval() in the actual layer. For example name a layer with this:

x=Math.PI; y=2; z=thisLayer.width

Then create a text layer and put this as the expression in the "source text":


myLayer = thisComp.layer("x=Math.PI; y=2; z=thisLayer.width");
eval(myLayer.name);
x*y+z


Unfortunately, I don't think it goes beyond numbers and simple expressions. You can only use "thisLayer" as well--no referencing other layers. Plus layer names don't update as well as you'd like when you change the expression.

Another option is to use scripts:
Zorro the Layer Tagger combined with Expression Toolbox from aescripts.com

Dan Fredley


Return to posts index

Roland R. Kahlenberg
Re: AE Expressions: Refercing a code block
on Jan 4, 2012 at 1:37:33 am

Re-pasting isn't as difficult if you first select the source property and choose Edit>Copy Expression Only. Then simply select the target layers and CTRL+V, to paste the Expression.

You can group layers in the Timeline, using the similar colors for each layer's Layer Color Tab. Then right-click on the color tab of one of the layers and select, Select Label Group.

HTH
RoRK

Intensive AE & Mocha Training in Singapore and Malaysia
Adobe ACE/ACI (version 7) & Imagineer Systems Inc Approved Mocha Trainer


Return to posts index

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