Skip to content

Instantly share code, notes, and snippets.

@kuroyam
Last active May 27, 2018 01:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuroyam/5692642 to your computer and use it in GitHub Desktop.
Save kuroyam/5692642 to your computer and use it in GitHub Desktop.
AfterEffectsのコンポジション内の全レイヤー座標をplist形式で出力。 左上が原点の座標系(cocos2dの場合はwindowのheightから引く必要あり)。
// AEPositionExporter.jsx
function exportPositionData(comp)
{
var layers = comp.layers;
var file = new File("position.plist");
if (file.open("w")) {
file.writeln('<?xml version="1.0" encoding="UTF-8"?>');
file.writeln('<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">');
file.writeln('<plist version="1.0">');
file.writeln('<dict>');
for (var i = 1; i <= comp.numLayers; i++) {
var layer = layers[i];
var time = layer.inPoint;
var position = layer.transform.position.valueAtTime(time, false);
// key = filename
// CCPointFromStringで読み込む方式に変えた
file.writeln(' <key>' + layer.name + '</key>');
file.writeln(' <string>{' + position[0] + ',' + position[1] + '}</string>');
};
file.writeln('</dict>');
file.writeln('</plist>');
file.close();
}
}
var comp = app.project.activeItem;
exportPositionData(comp);
@flyzion7
Copy link

AfterEffectsで書き出したファイルを、直接cocos2d-xで書き出して描画する方法をご存知でしょうか?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment