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

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

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

Thanks Paul!
Post Reply