Add Animator to text layer

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
ernpchan
Posts: 56
Joined: February 8th, 2010, 11:27 pm

July 9th, 2015, 6:08 pm

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

July 19th, 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
Posts: 56
Joined: February 8th, 2010, 11:27 pm

July 23rd, 2015, 11:32 am

Thanks Paul!
Post Reply