FORUMS: list search recent posts

Can a script write an expression?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jake Revill
Can a script write an expression?
on Aug 7, 2012 at 6:26:31 pm

Hello all, I have searched high and low for an answer for what seems to be a simple question:

Can you write a script that applies an expression to a particular attribute for you?

I have an expression I would like to apply to a position attribute:

value + [Math.sin(time),Math.cos(time),0];

I can do this easy inside after effects by alt clicking the stop watch, but i want to be able to run a script that does this for me.

Can this be done and if so how?

Any help would be greatly appreciated!

value + [Math.sin(time),Math.cos(time),0];


Return to posts index

Dan Ebberts
Re: Can a script write an expression?
on Aug 7, 2012 at 7:12:27 pm

Assuming it's the first layer and it's selected, this should work:

var myLayer = app.project.activeItem.layer(1);
myLayer.property("Position").expression = "value + [Math.sin(time),Math.cos(time),0];";



Dab



Return to posts index

Jake Revill
Re: Can a script write an expression?
on Aug 7, 2012 at 7:14:12 pm

Thank you so much, it was the simple .expression I was looking for all along.

Cheers Dab, or did you mean Dan? :)


Return to posts index


Dan Ebberts
Re: Can a script write an expression?
on Aug 7, 2012 at 7:17:17 pm

I do that all the time--probably because the b and n keys are right next to each other.

Dan



Return to posts index

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