Expressions/Scripts/Presets

Moderator: Paul Tuersley

 
ernpchan
Topic Author
Posts: 56
Joined: Mon Feb 08, 2010 11:27 pm

Add Animator to text layer

Thu Jul 09, 2015 6:08 pm

Does anybody have an example of adding the Animator to a text layer?
 
Paul Tuersley
Posts: 704
Joined: Sat Jun 05, 2004 7:59 am
Location: London, UK

Re: Add Animator to text layer

Sun Jul 19, 2015 8:34 am

Assuming you have a comp open with a text layer as the first layer:

var activeItem = app.project.activeItem;
var theTextLayer = activeItem.layer(1);
var textAnimGroup = theTextLayer.property("ADBE Text Properties").property("ADBE Text Animators");
var theTextAnimator = textAnimGroup.addProperty("ADBE Text Animator");
alert("added " + theTextAnimator.name);

I highly recommend you get Jeff Almasol's GimmePropPaths script as you can work out all kinds of things like this using it:
http://www.redefinery.com/ae/view.php?i ... mePropPath

For example, I added a text layer and text animator, selected the animator and got the full property path for it using GimmePropPaths:
app.project.item(2).layer("test").property("ADBE Text Properties").property("ADBE Text Animators").property("ADBE Text Animator")

This gave me the additional information I needed to write the code above. Although I was already aware that the invisible containing group for all text animators ("ADBE Text Animators") is a permanent, default property of a text layer, so only the specific animator you want needs to be added into that group.

Paul
 
ernpchan
Topic Author
Posts: 56
Joined: Mon Feb 08, 2010 11:27 pm

Re: Add Animator to text layer

Thu Jul 23, 2015 11:32 am

Thanks Paul!

Who is online

Users browsing this forum: No registered users and 4 guests