エクスプレッションTips
Nexanimで使える実践的なエクスプレッションを、用途ごとに整理して紹介します。
進行度コントロール用
参照先となるエフェクト名・レイヤー名は環境に合わせて変更してください。
1つのキーで開始タイミングをずらす
イージングは変えずに、タイミングだけをずらして、1つ目のキーを開始点とします。
sourceP = effect("P:位置-トランスフ-1Position-Trans-1_1")(1); offset = sourceP.key(1).time - key(1).time;sourceP.valueAtTime(time + offset);2つのキーでアニメーションを伸縮
イージングは変えずに、2つのキーで開始点と終了点を定めて、アニメーション全体を伸縮させます。
sourceP = effect("P:位置-トランスフ-1Position-Trans-1_1")(1); mappedTime = linear(time, key(1).time, key(2).time, sourceP.key(1).time, sourceP.key(sourceP.numKeys).time);sourceP.valueAtTime(mappedTime);レイヤー尺に合わせてアニメーションを伸縮
イージングは変えずに、アニメーション全体をレイヤー尺に合わせて伸縮させます。
sourceP = thisComp.layer("ctrl").effect("P:位置-トランスフ-1Position-Trans-1_1")(1); mappedTime = linear(time, thisLayer.inPoint, thisLayer.outPoint, sourceP.key(1).time, sourceP.key(sourceP.numKeys).time);sourceP.valueAtTime(mappedTime);末尾番号で自動参照
末尾番号が同じ、特定の進行度コントロールPを自動で参照します。
sourceP = effect("P:位置-トランスフ-1Position-Trans-1_1")(1); sourcePControlId = sourceP.propertyGroup(1).name.replace(/^P:/, "").replace(/_\d+$/, "");indexNum = thisProperty.propertyGroup(1).name.match(/_(\d+)$/)[1];sourceP = effect("P:" + sourcePControlId + "_" + indexNum)(1);sourceP;値コントロール用
X値をYとZに連動
主にスケールに使える式で、X値をYとZにも反映します。
[value[0], value[0], value[0]];Last updated on