LoginSignup
1
2

More than 5 years have passed since last update.

テキストレイヤーのプロパティ構造を理解する

Last updated at Posted at 2017-04-28

少し自分の中でややこしかったのでメモです。

やりたい事

テキストレイヤーにアニメーターの不透明度を設定する

bandicam 2017-04-28 11-42-56-735.jpg

このAE画面上の通りプロパティを辿ると
コンポジションの中のテキストレイヤーのテキストプロパティーのアニメーターの不透明度という事になるはず。

まずは間違っているコード

var myComp = app.project.activeItem;
var myLayer = myComp.selectedLayers[0];
var text_ani=myLayer.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Opacity").setValue(50);

実行結果

bandicam 2017-04-28 11-49-53-070.jpg

このPropertyGroupには「ADBE Text Opactiy」というプロパティを追加できません。となる。

りょ!(了解の略)ってなるわけで
ふぅ~(ため息)・・・
じゃあ一度手作業でアニメータの不透明度を追加してみる。

bandicam 2017-04-28 11-57-42-171.jpg

何かおかしくありませんか?

アニメーター1という項目が出てきて、ここにもまた追加というプロパティを持ったものが出てきてます。

bandicam 2017-04-28 11-59-58-888.jpg

今回の勘違いをまとめると

テキストのプロパティから透明度を追加してもアニメーター1というグループを作らないとダメだという事です。
それがmyLayer.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Animator");
この赤文字の部分でアニメーター1を追加しその中に

text_ani.property("ADBE Text Animator Properties").addProperty("ADBE Text Opacity").setValue(50);
text_ani.property("ADBE Text Selectors").addProperty("ADBE Text Selector");

を書かないと駄目なんですね。。。
このコードは透明度を50に設定して範囲セレクター1も追加しています。
myLayer.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Animator");
この中にアニメーター1のプロパティーやセレクターを追加していく感じですね!

正しいコードはこうなります

※アンドゥグループで囲ってます。

app.beginUndoGroup("textProperty");//アンドゥグループ開始

var myComp = app.project.activeItem;
var myLayer = myComp.selectedLayers[0];
var text_ani=myLayer.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Animator");
text_ani.property("ADBE Text Animator Properties").addProperty("ADBE Text Opacity").setValue(50);
text_ani.property("ADBE Text Selectors").addProperty("ADBE Text Selector");

app.endUndoGroup();//アンドゥグループの終わり

この結果を見てみれば、当然の事なんですが、何もない状態からAEの画面上でプロパティを辿って行くとこうなってしまいました。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2