ae expression cheat sheet
1.0.0
物体 | 説明 | 例 |
---|---|---|
thisComp | 現在の構成 | thisComp; |
thisLayer | 現在のレイヤー | thisLayer.transform.scale[1]; |
thisProperty | 現在のプロパティ式に適用されます。 | thisProperty[1]; |
time | 数秒でカーソル位置での現在のタイムコード。 | "Seconds: " + time; |
value | 現在のプロパティに関連付けられた現在の値。 | value + "_TEST"; |
物体 | 説明 | 例 |
---|---|---|
colorDepth | ピクセルあたりビットのプロジェクトの色深度。 | colorDepth; |
関数 | 説明 |
---|---|
layer(index || number) | レイヤー、ライト、またはカメラオブジェクトを返します。 |
layer(layer, relIndex) | 指定されたレイヤーの相対インデックスでオブジェクトを返します。 |
関数 | 説明 | 例 |
---|---|---|
framesToTime(frames, fps) | フレームを数秒でタイムコードに変換します。 | framesToTime(50, 1.0 / thisComp.frameDuration); |
timeToCurrentFormat(t, fps, isDuration) | タイムコードを現在のプロジェクト設定ディスプレイ形式に変換します。 | |
timeToFeetAndFrames(t, fps, framesPerFoot, isDuration) | タイムコードをフィートとフレーム形式に変換します。 | |
timeToFrames(t, fps, isDuration) | タイムコードをフレームに変換します。 | |
timeToNTSCTimecode(t, ntscDropFrame, isDuration) | ドロップフレームの有無にかかわらず、タイムコードをNTSCタイムコードに変換します。 | |
timeToTimecode(t, timecodeBase, isDuration) | 指定されたタイムベースを使用して、タイムコードを他のタイムコードに変換します。 |
関数 | 説明 | 例 |
---|---|---|
comp(name) | 指定された名前の開いた構成を見つけます。 | comp("Comp 1"); |
footage(name) | 指定された名前のプロジェクト映像を見つけます。 | footage("RedHarring.png"); |
あなたが持っている:
あなたはしたい:
解決:
長方形の形状の形状層があるとしましょう。
長方形のレイヤーの親をテキストレイヤーに設定すると、テキストレイヤーのポジショニングに比べて位置決めされます。
Rectangle Pathのサイズプロパティに次の式を追加します
var textLayer = thisComp . layer ( "Text Layer 1" ) ;
var textRect = textLayer . sourceRectAtTime ( time - textLayer . inPoint , true ) ;
// set size of rectangle path to text rectangle's width and height
[ textRect . width , textRect . height ] ;
これにより、長方形のサイズがテキストのサイズに設定されます。複数の行がある場合、すべてのラインのフルサイズが必要です。
var rectPath = content ( "Rectangle 1" ) . content ( "Rectangle Path 1" ) ;
var x = rectPath . size [ 0 ] ;
var y = rectPath . size [ 1 ] ;
// set position of rectangle path to text rectangle's width and height
[ x / 2 , - ( y / 2 ) ] ;
これにより、レイヤーの左上への長方形の経路の左下の位置が設定されます。テキストレイヤーには、常にテキストの最初の行の左下にアンカーポイントがあります。これにより、計算がより簡単になります。
var textLayer = thisComp . layer ( "Text Layer 1" ) ;
var textRect = textLayer . sourceRectAtTime ( time - textLayer . inPoint , true ) ;
[ textLayer . transform . position [ 0 ] + textRect . left ,
textLayer . transform . position [ 1 ] + textRect . top + textRect . height ] ;
これにより、長方形の層の位置がテキストの位置に設定されます。長方形のサイズを追加する理由は、フォントレンダリングにより最初の文字が位置から数ピクセルになる可能性があるためです。長方形座標を追加すると、それが補正されます。
問題:
あなたが持っている:
あなたはしたい:
50 Hzのインターレースのように見えるように、ビデオに水平ジッターを追加します。
解決:
[ transform . position [ 0 ] , transform . position [ 1 ] + ( ( timeToFrames ( time ) % 2 ) * 2 ) ]
問題:
ジッターは重すぎて、式の乗算を削除することでこれを解決できます
[ transform . position [ 0 ] , transform . position [ 1 ] + ( timeToFrames ( time ) % 2 ) ]
または、非常に微妙なシェイクを得るために、半分にそれを複数挙げます。
[ transform . position [ 0 ] , transform . position [ 1 ] + ( ( timeToFrames ( time ) % 2 ) * 0.5 ) ]
テキストは垂直に中央に配置する必要があります。次の式をテキストレイヤーの変換に追加します。ポジションプロパティ
S = thisLayer ;
x = transform . position [ 0 ] ;
y = transform . position [ 1 ] ;
rect = S . sourceRectAtTime ( time , false ) ;
y_offset = rect . height / 2 ;
[ x , y - y_offset ]