FORUMS: list search recent posts

Applying an effect to a layer through a script

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Corey Drake
Applying an effect to a layer through a script
on Sep 22, 2011 at 2:15:59 am

I've been dipping my feet into extendscript a bit and I was wondering how I would go about doing this:

User selects two nulls with animated position
User selects footage layer
Script applies effect, say, a ramp to footage
Script copies keyframes from 1st null to start of ramp
Script copies keyframes from 2nd null to end of ramp

Any help would be really appreciated.


Return to posts index

Dan Ebberts
Re: Applying an effect to a layer through a script
on Sep 22, 2011 at 3:08:43 pm

Applying an effect to a layer is easy:

myLayer.property("Effects").addProperty("Ramp");

Copying keyframes can be complicated, depending on the nature of the keyfames, especially if there is easing to consider. Actually, you can't just copy them from one property to another, you have to re-create them. As an alternative, you might consider just having the script apply expressions linking the Start of Ramp and End of Ramp properties to the position of the nulls.


Dan



Return to posts index

Corey Drake
Re: Applying an effect to a layer through a script
on Sep 22, 2011 at 3:24:18 pm

Great! Thanks. You mention applying an expression through a script. I didn't know that could be done. In fact, that would actually help me skip a whole process and make things way easier for me. Could you give an example of how to do that or point me in a direction where I can learn that?


Return to posts index


Dan Ebberts
Re: Applying an effect to a layer through a script
on Sep 22, 2011 at 3:51:57 pm

It's pretty straight forward. I haven't tested this code, but it would look something like this:

var myEffect = myLayer.property("Effects").addProperty("Ramp");
var myProperty = myEffect.property("Start of Ramp");
myProperty.expression = 'thisComp.layer("Null 1").transform.position';


You might have to construct the expression on the fly if you don't know the name of the target layer (Null 1 in this case) at the time you write the script.


Dan



Return to posts index

Corey Drake
Re: Applying an effect to a layer through a script
on Sep 22, 2011 at 3:56:57 pm

Thank you very much. This is going to help so much.


Return to posts index

Corey Drake
Re: Applying an effect to a layer through a script
on Sep 22, 2011 at 8:40:33 pm

Thank you very much. This is going to help so much

[Edit] Also, I was wondering how to get a list of selected items within the comp. I've found the items and selection attributes, but they seem to work for the project panel. Do I have to do something with activeItem first?


Return to posts index


Corey Drake
Re: Applying an effect to a layer through a script
on Sep 22, 2011 at 8:55:57 pm

[edit2] I have found the compItem attributes, so I am good to go. No I wonder, how can I check if a selected layer is a null or a solid?


Return to posts index

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