如何在JavaScript中建立文字在After Effects中
P粉464113078
P粉464113078 2023-07-28 20:44:45
0
1
475
<p>我嘗試使用addText(text)來建立文本,但是當我點擊執行按鈕時,沒有任何反應。 </p><p>以下是程式碼的片段:</p><p><br /></p> <pre class="brush:php;toolbar:false;">button6.onClick = function() { addText(); function addText() { app.beginUndoGroup("My Process"); var comp = app.project.activeItem; var selectedlayer = comp.selectedLayers[0]; if (comp == null) { alert("No composition selected"); } if (comp.selectedLayers[0] == null) { alert("Select the layer"); } var outpoint = comp.selectedLayers[0].outPoint; var inpoint = comp.selectedLayers[0].inPoint; var duration = outpoint - inpoint; var textLayer = comp.layers.addText(text); var sourceText = textLayer.property("Source Text").value; sourceText.fontSize = 100; sourceText.font = Arial; textLayer.property("Source Text").setValue(sourceText); textLayer.adjustmentLayer = false; textLayer.inPoint = inpoint; textLayer.label = 1; comp.layer(1).moveBefore(selectedlayer); app.endUndoGroup(); } }</pre> <p>我嘗試使用addBoxText(text)來建立文本,但結果是一樣的。 </p>
P粉464113078
P粉464113078

全部回覆(1)
P粉178132828

如果您使用的是純JavaScript,事件函數的名稱應該是onclick,而不是onClick。

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!