{"id":3896,"date":"2009-11-21T19:58:55","date_gmt":"2009-11-21T10:58:55","guid":{"rendered":"http:\/\/leavebehind.iobb.net\/wordpress\/?p=3896"},"modified":"2009-11-21T19:58:55","modified_gmt":"2009-11-21T10:58:55","slug":"affter-effect-estk-code-snippets","status":"publish","type":"post","link":"http:\/\/leavebehind.mydns.jp\/wordpress\/2009\/11\/21\/affter-effect-estk-code-snippets\/","title":{"rendered":"Affter Effect &#038; ESTK Code Snippets"},"content":{"rendered":"<p>AffterEffects\u7528\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u4f5c\u6210\u306e\u969b\u306e\u65ad\u7247\u96c6\u3002\u305f\u307e\uff5e\u306b\u5c11\uff5e\u3057\u3050\u3089\u3044\u306f\u5f79\u306b\u7acb\u3064\u3053\u3068\u3082\u66f8\u304d\u307e\u3059\u3088\u3002<\/p>\n<p>AfterEffects8(CS3)\u3068\u4ed8\u5c5e\u306eExtendScript Toolkit 2\u3067\u306e\u304a\u8a71\u3067\u3059\u3002<\/p>\n<p>\u307e\u305a\u306fESTK\u5074\u3067\u64cd\u4f5c\u5bfe\u8c61\u3092AfterEffects\u306b\u8a2d\u5b9a\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/leavebehind.iobb.net\/wordpress\/wp-content\/uploads\/2009\/11\/linkToAfx.jpg\" alt=\"linkToAfx\" title=\"linkToAfx\" width=\"640\" height=\"210\" class=\"aligncenter size-full wp-image-3897\" \/><br \/>\n<strong>\u64cd\u4f5c\u5bfe\u8c61\u306e\u53d6\u5f97<\/strong><br \/>\n\u4e00\u756a\u3088\u304f\u4f7f\u3046\u306e\u304c\u9078\u629e\u3057\u305f\u30ec\u30a4\u30e4\u306b\u5bfe\u3057\u3066\u306e\u64cd\u4f5c\u306a\u306e\u3067\u3002<\/p>\n<pre>targetLayers = app.project.activeItem.selectedLayers;<\/pre>\n<p>\u3053\u308c\u3067\u3001\u914d\u5217\u300ctargetLayers\u300d\u306b\u30ec\u30a4\u30e4\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002\u9078\u629e\u3057\u305f\u30ec\u30a4\u30e4\u3092\u4e00\u3064\u3060\u3051\u53d6\u5f97\u3057\u305f\u3044\u306a\u3089\u3001<\/p>\n<pre>targetLayer = app.project.activeItem.selectedLayers[0];<\/pre>\n<p>\u524d\u5f8c\u3057\u307e\u3059\u304c\u3001\u73fe\u5728\u4f5c\u696d\u4e2d\u306e\u30b3\u30f3\u30dd\u30b8\u30b7\u30e7\u30f3\u3092\u5f97\u308b\u306b\u306f\u4ee5\u4e0b\u3002<\/p>\n<pre>activeComp = app.project.activeItem;<\/pre>\n<p><!--more--><br \/>\n<strong>\u6642\u9593<\/strong><br \/>\n\u30b9\u30d7\u30ea\u30d7\u30c8\u5185\u3067\u306f\u6642\u9593\u6307\u5b9a\u306f\u6d6e\u52d5\u5c0f\u6570\u70b9\u5024\u3067\u306e\u6307\u5b9a\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\u3064\u307e\u308a\u30b3\u30f3\u30dd\u30b8\u30b7\u30e7\u30f3\u304c30fps\u306761\u30d5\u30ec\u30fc\u30e0\u76ee\u3092\u6307\u5b9a\u3057\u305f\u3044\u5834\u5408\u300c2.03333333333333\u300d\u3068\u3057\u307e\u3059\u3002\u30d5\u30ec\u30fc\u30e0\u304b\u3089\u3053\u306e\u6642\u9593\u3092\u5f97\u308b\u306b\u306f\u3001<\/p>\n<pre>floatTime = currentFormatToTime(61,30)<\/pre>\n<p>\u3068\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u6587\u5b57\u5217\u3092\u4f7f\u7528\u3057\u3066\u3001<\/p>\n<pre>floatTime = currentFormatToTime(\"00:00:02:01\",30)<\/pre>\n<p>\u3068\u3059\u308b\u3053\u3068\u3082\u51fa\u6765\u307e\u3059\u3002\u7b2c2\u5f15\u6570\u309230\u3068\u3057\u3066\u3044\u308b\u306e\u306f30fps\u3067\u8a08\u7b97\u3057\u3066\u3044\u308b\u3068\u8a00\u3046\u3053\u3068\u3067\u3059\u304c\u30b3\u30f3\u30dd\u30b8\u30b7\u30e7\u30f3\u306e\u30d5\u30ec\u30fc\u30e0\u30ec\u30fc\u30c8\u3092\u77e5\u308b\u306b\u306f\u3001<\/p>\n<pre>\nactiveComp = app.project.activeItem;\nfps = 1\/activeComp.frameDuration;\nfloatTime = currentFormatToTime(\"00:00:02:01\",fps)\n<\/pre>\n<p>\u3068\u3057\u307e\u3059\u3002\u56de\u308a\u304f\u3069\u3044\u3084\u308a\u65b9\u3067\u3059\u304c\u76f4\u63a5\u30d5\u30ec\u30fc\u30e0\u30ec\u30fc\u30c8\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u306f\u51fa\u6765\u307e\u305b\u3093\u30011\u30d5\u30ec\u30fc\u30e0\u306e\u7d99\u7d9a\u6642\u9593\u306e\u9006\u6570\u3092\u53d6\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u30d5\u30ec\u30fc\u30e0\u30ec\u30fc\u30c8\u3092\u5f97\u307e\u3059\u3002<\/p>\n<p><strong>\u30ec\u30a4\u30e4\u306e\u64cd\u4f5c<\/strong><br \/>\n\u7c21\u5358\u306a\u3068\u3053\u308d\u3067\u30ec\u30a4\u30e4\u4f4d\u7f6e\u306e\u64cd\u4f5c\u3067\u3059\u3002<\/p>\n<pre>targetComp = app.project.activeItem;\ntargetLayer = app.project.activeItem.selectedLayers[0];\ntargetLayer.transform.position.setValue([50,100]);\n<\/pre>\n<p>\u30ec\u30a4\u30e4\u3092\u3072\u3068\u3064\u9078\u3093\u3067\u5b9f\u884c\u3057\u307e\u3059\u3002\u4f4d\u7f6e\u3092x=50,y=100\u3078\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002\u4f46\u3057setValue()\u30e1\u30bd\u30c3\u30c9\u306f\u30ad\u30fc\u3092\u6301\u305f\u306a\u3044\u5834\u5408\u306b\u9650\u308a\u4f7f\u3048\u307e\u3059\u3002\u30ad\u30fc\u3092\u6301\u3063\u3066\u3044\u308b\u5834\u5408\u306fsetValueAtTime()\u3092\u4f7f\u7528\u3057\u3066\u65b0\u305f\u306b\u30ad\u30fc\u3092\u6253\u3061\u5024\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre>\ntargetComp = app.project.activeItem;\ntargetLayer = app.project.activeItem.selectedLayers[0];\ntargetLayer.transform.position.setValueAtTime(targetComp.time,[50,100]);\n<\/pre>\n<p>\u4e0a\u306e\u4f8b\u306f\u73fe\u5728\u306e\u6642\u9593\u306b\u30ad\u30fc\u3092\u6253\u3063\u3066\u3044\u307e\u3059\u3002\u5408\u308f\u305b\u6280\u3067\u3001\u300c\u30ad\u30fc\u3092\u6301\u305f\u306a\u3051\u308c\u3070\u30ad\u30fc\u3092\u6253\u305f\u305a\u306b\u4f4d\u7f6e\u3092\u8a2d\u5b9a\u300d\u3001\u300c\u30ad\u30fc\u304c\u4ed6\u306b\u3042\u308c\u3070\u30ad\u30fc\u3092\u6253\u3064\u300d\u3088\u3046\u306b\u3059\u308b\u306a\u3089\u3001<\/p>\n<pre>targetComp = app.project.activeItem;\ntargetLayer = app.project.activeItem.selectedLayers[0];\nif(targetLayer.transform.position.numKeys == 0){\n\ttargetLayer.transform.position.setValue([50,100]);\n}else{\n\ttargetLayer.transform.position.setValueAtTime(targetComp.time,[50,100]);\n}\n<\/pre>\n<p><strong>\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u8fbc\u307f<\/strong><br \/>\n\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u8fbc\u307f\u305f\u3044\u6642\u306f\u3002<\/p>\n<pre>\nfp = new File(\"C:&yen;&yen;text.txt\");\nfp.open(\"r\");\n<\/pre>\n<p>\u3067\u3059\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u8868\u3059\u300c&yen;(\u5186\u30de\u30fc\u30af\u3001\u74b0\u5883\u306b\u3088\u3063\u3066\u306f\u30d0\u30c3\u30af\u30b9\u30e9\u30c3\u30b7\u30e5)\u300d\u306f\u30a8\u30b9\u30b1\u30fc\u30d7\u6587\u5b57\u306a\u306e\u30672\u3064\u91cd\u306d\u3066\u304a\u304d\u307e\u3059\u3002\u3061\u306a\u307f\u306b&#8221;r&#8221;\u306f\u30ea\u30fc\u30c9\u30aa\u30f3\u30ea\u30fc\u3067\u958b\u3044\u3066\u3044\u307e\u3059\u3002\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u51e6\u7406\u304c\u7d42\u308f\u308bor\u4e2d\u65ad\u3059\u308b\u3068\u304d\u306b\u306f\u5fc5\u305a\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u30d5\u30a1\u30a4\u30eb\u3092\u9589\u3058\u307e\u3059\u3002<\/p>\n<pre>fp.close();<\/pre>\n<p>\u3082\u3046\u5c11\u3057\u4f7f\u3048\u308b\u4f8b\u3068\u3057\u3066\u3001\u300c\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\u300d\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\u3057\u3066\u30c6\u30ad\u30b9\u30c8\u3092\u958b\u304d\u3001\uff11\u884c\u305a\u3064\u8aad\u307f\u8fbc\u3093\u3067\u30b4\u30cb\u30e7\u30b4\u30cb\u30e7\u3059\u308b\u306b\u306f\u3001<\/p>\n<pre>fp= File.openDialog();\nif(fp != null){\n\tfp.open(\"r\");\n\twhile(!fp.eof){\n\t\taLine = fp.readln();\n\t\t\/\/\u30b4\u30cb\u30e7\u30b4\u30cb\u30e7\n\t}\n\tfp.close();\n}\n<\/pre>\n<p>\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u51fa\u3057\u3066\u3082\u30ad\u30e3\u30f3\u30bb\u30eb\u3057\u305f\u5834\u5408\u3001fp\u306fnull\u306b\u306a\u308aopen()\u30e1\u30bd\u30c3\u30c9\u5b9f\u884c\u6642\u306b\u30a8\u30e9\u30fc\u306b\u306a\u308b\u306e\u3067null\u306e\u5834\u5408\u306f\u51e6\u7406\u3092\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002readln()\u3092\u5b9f\u884c\u3059\u308b\u3068\u5909\u6570\u300caLine\u300d\u3078\u4e00\u884c\u5206\u306e\u6587\u5b57\u5217\u3092\u5165\u308c\u3001\u8aad\u307f\u51fa\u3059\u884c\u3092\u6b21\u3078\u9032\u3081\u307e\u3059\u3002\u3053\u308c\u3092\u7e70\u308a\u8fd4\u3057\u300cFile.eof\u300d\u3064\u307e\u308aEnd Of File\u306b\u306a\u308b\u3068\u30eb\u30fc\u30d7\u3092\u629c\u3051\u307e\u3059\u3002<\/p>\n<p>\u958b\u304f\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u304c<acronym title=\"Comma-Separated Values\">CSV<\/acronym>\u306a\u3089\u30b4\u30cb\u30e7\u30b4\u30cb\u30e7\u3059\u308b\u524d\u306b<\/p>\n<pre>dataArray = aLine.split(\",\");<\/pre>\n<p>\u3092\u5165\u308c\u3066\u4e00\u5ea6\u914d\u5217\u306b\u3059\u308c\u3070\u3044\u3044\u3067\u3059\u3002\u307e\u305f\u8aad\u307f\u8fbc\u3093\u3060\u30c7\u30fc\u30bf\u306f\u6570\u5b57\u3067\u3042\u3063\u3066\u3082\u6587\u5b57\u5217\u306a\u306e\u3067\u3001\u6570\u5024\u3068\u3057\u3066\u4f7f\u7528\u3057\u305f\u5834\u5408\u306f\u3001<\/p>\n<pre>floatVal = parseFloat(dataArray[0])<\/pre>\n<p>\u3068\u3057\u3066\u6570\u5024\u306b\u578b\u5909\u63db\u3057\u3066\u304b\u3089\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u3053\u306e\u300c\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3080\u30b9\u30af\u30ea\u30d7\u30c8\u300d\u306fAffterEffects\u306b\u9650\u3089\u305aPhotoShop\u3084Illustrator\u3067\u3082\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>\u6a19\u6e96\u51fa\u529b<\/strong><br \/>\nESTK\u306b\u30c7\u30d0\u30c3\u30ac\u304c\u4ed8\u3044\u3066\u306f\u3044\u307e\u3059\u304c\u3001\u5b9f\u884c\u4e2d\u3082\u3063\u3068\u624b\u8efd\u306b\u5909\u6570\u306e\u5024\u306a\u3069\u3092\u77e5\u308a\u305f\u3044\u5834\u5408\u306f\u3001ESTK\u306e\u300cJavaScript\u30b3\u30f3\u30bd\u30fc\u30eb\u300d\u3078\u51fa\u529b\u3057\u307e\u3059\u3002<\/p>\n<pre>$.write(\"My Value : \" + floatVal);<\/pre>\n<p>\u3067\u3059\u3002\u6539\u884c\u304c\u5fc5\u8981\u306a\u3089<\/p>\n<pre>$.writeln(\"My Value : \" + floatVal);<\/pre>\n<p>\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3060\u3051\u66f8\u3044\u3068\u3051\u3070\u3001\u5fd8\u308c\u306a\u3044\u304b\u306a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AffterEffects\u7528\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u4f5c\u6210\u306e\u969b\u306e\u65ad\u7247\u96c6\u3002\u305f\u307e\uff5e\u306b\u5c11\uff5e\u3057\u3050\u3089\u3044\u306f\u5f79\u306b\u7acb\u3064\u3053\u3068\u3082\u66f8\u304d\u307e\u3059\u3088\u3002 AfterEffects8(CS3)\u3068\u4ed8\u5c5e\u306eExtendScript Toolkit 2\u3067\u306e\u304a\u8a71\u3067\u3059\u3002 \u307e\u305a\u306fE [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3,5],"tags":[35,152],"class_list":["post-3896","post","type-post","status-publish","format-standard","hentry","category-automation","category-cg","tag-aftereffects","tag-javascript"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p8YSE4-10Q","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/posts\/3896","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/comments?post=3896"}],"version-history":[{"count":0,"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/posts\/3896\/revisions"}],"wp:attachment":[{"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/media?parent=3896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/categories?post=3896"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/leavebehind.mydns.jp\/wordpress\/wp-json\/wp\/v2\/tags?post=3896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}