Skip to content

Instantly share code, notes, and snippets.

@FryPotato893
Last active March 6, 2019 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FryPotato893/740cbf6fd6cff4ac0562a3f940bf6ef3 to your computer and use it in GitHub Desktop.
Save FryPotato893/740cbf6fd6cff4ac0562a3f940bf6ef3 to your computer and use it in GitHub Desktop.
【After Effects】選択したレイヤーをタイムリマップでコマ打ち
// frameHittingWithTimeRemap
// タイムリマップでコマ打ち
// コマ打ちするコマ数
var frameHit = 2;
// アクティブなコンポジションを取得
var activeComp = app.project.activeItem;
// アクティブなレイヤー名を取得
var selectedLayers = activeComp.selectedLayers;
// フレームレートを取得
var frameDuration = 1/activeComp.frameDuration;
for (var i = 0; i < selectedLayers.length; i++) {
var curLayer = selectedLayers[i];
// タイムリマップをON
curLayer.timeRemapEnabled = true;
// コンプのデュレーションを取得
du = activeComp.duration;
for (var d = 0; d < du*frameDuration; d++){
// 奇数の場合はリマップにキーを打つ
if(d%frameHit == 0){
if(d<selectedLayers[i].outPoint*frameDuration){
curLayer.timeRemap.setValueAtTime(d/frameDuration,d/frameDuration);
// キーの補間を停止に変更
curLayer.timeRemap.setInterpolationTypeAtKey(1,KeyframeInterpolationType.HOLD);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment