word文本样式代码样式_使用文本样式表达创建真相来源
word文本樣式代碼樣式
As of After Effects 17.0, you can use expressions to edit text styles in After Effects. Here’s why this would transform your workflow:
從After Effects 17.0開始,您可以使用表達式在After Effects中編輯文本樣式。 這就是這將改變您的工作流程的原因:
Example:
例:
You have three text layers. You want to maintain the same styling and source text for all, but you want to control Paragraph Alignment in the Essential Graphics panel.
您有三個文本層。 您希望為所有對象保留相同的樣式和源文本,但是要在“基本圖形”面板中控制“段落對齊”。
For the skeptics: Yes, you can manually change the paragraph alignment, but you’re likely pushing the same copy to multiple comps at various sizes. The After Effects gods gave us new features so that maybe we can work more precisely and intelligently. Keep things simple for simpler projects, and go a little complex for more complex projects.
對于懷疑者:是的,您可以手動更改段落的對齊方式,但是您可能會將同一副本推入各種大小的多個伴奏中。 After Effects神靈為我們提供了新功能,以便我們可以更精確,更智能地工作。 對于較簡單的項目,請保持簡單;對于較復雜的項目,則應使它變得有些復雜。
Recipe:
食譜:
Add this expression to each of the three text layers:
將此表達式添加到三個文本層中的每個:
var t = thisComp.layer("MASTER TITLE").text.sourceText; var fontSize = t.style.fontSize; var leading = t.style.leading; style = t.style; styleA = style.setFontSize(fontSize); styleB = styleA.setText(t); styleC = styleB.setLeading(leading);
var t = thisComp.layer("MASTER TITLE").text.sourceText; var fontSize = t.style.fontSize; var leading = t.style.leading; style = t.style; styleA = style.setFontSize(fontSize); styleB = styleA.setText(t); styleC = styleB.setLeading(leading);
Explanation, line by line:
逐行說明:
var t = thisComp.layer("MASTER TITLE").text.sourceText;
var t = thisComp.layer("MASTER TITLE").text.sourceText;
Declare a variable, t, and return the value of your master text layer’s sourceText.
聲明一個變量t,并返回主文本層的sourceText的值。
var fontSize = t.style.fontSize;
var fontSize = t.style.fontSize;
Declare a variable, fontSize, and return the fontSize of t.
聲明一個變量fontSize ,并返回t的fontSize。
var leading = t.style.leading;
var leading = t.style.leading;
Declare a variable, leading, and return the leading of t.
聲明一個變量, leading ,并返回t的領先。
style = t.style;
style = t.style;
Adding style to the end is the same as using getStyleAt(0); which means to get the style of t at Character Index 0. You can also use getStyleAt(n, x); to return the Character Index at Time (n = character index, x = time in seconds).
最后添加style與使用getStyleAt(0); 您也可以使用getStyleAt(n, x);來獲取字符索引0處的t樣式getStyleAt(n, x); 返回時間的字符索引(n =字符索引,x =以秒為單位的時間)。
The variables styleA, styleB, and styleC combine Set Functions using the variables we declared above: fontSize, sourceText, and leading. I’ve separated each style for clarity, but you can also write everything in longform.
變量styleA,styleB和styleC使用我們上面聲明的變量fontSet,sourceText和Lead組合了Set函數。 為了清楚起見,我將每種樣式分開,但您也可以用長格式編寫所有內容。
Now that we’ve linked the text layers to a single style, let’s create a Dropdown Menu Control so that we can access Left, Center, or Right paragraph alignment in the Essential Graphics Panel.
現在,我們已經將文本圖層鏈接到一個樣式,現在我們創建一個下拉菜單控件,以便我們可以在Essential Graphics Panel中訪問Left,Center或Right段落對齊方式。
Use this expression on the opacity of your text layers (but make sure their visibility is still turned on):
在文本圖層的不透明度上使用此表達式(但請確保它們的可見性仍處于打開狀態):
var x = thisComp.layer("CONTROL").effect("paragraphAlign")("Menu").value; if (x == 1) 100; else 0
var x = thisComp.layer("CONTROL").effect("paragraphAlign")("Menu").value; if (x == 1) 100; else 0
Explanation, line by line:
逐行說明:
var x = thisComp.layer("CONTROL").effect("paragraphAlign")("Menu").value;
var x = thisComp.layer("CONTROL").effect("paragraphAlign")("Menu").value;
Declare a variable x, and return the value of a Dropdown Menu Item. The value of a Dropdown Menu item is always a number, even if you rename the label.
聲明一個變量x,并返回一個下拉菜單項的值。 即使重命名標簽,“下拉菜單”項的值也始終是數字。
if (x == 1) 100; else 0
if (x == 1) 100; else 0
If x is equal 1, the opacity will be 100. Otherwise, it will be zero.
如果x等于1,則不透明度將為100。否則,它將為零。
Note that you may encounter the triple equals operator, or the strict equality operator, ===, e.g., x === 1. This operator is special because it tests for both value (e.g., 5) and type (e.g., number).
請注意,您可能會遇到三重等于運算符或嚴格等于運算符=== ,例如x === 1 。 該運算符很特殊,因為它同時測試值(例如5)和類型(例如數字)。
In this example, x === 1 will still work. However, if you type x === "1", then the test will return false because the Dropdown Menu item values are always numbers, not strings.
在此示例中, x === 1仍然有效。 但是,如果鍵入x === "1" ,則測試將返回false,因為下拉菜單項的值始終是數字,而不是字符串。
Done! Now read more about text styling expressions over at Adobe.
做完了! 現在,在Adobe上閱讀有關文本樣式表達的更多信息。
Originally published at https://bytanchan.com on March 21, 2020.
最初于 2020年3月21日 在 https://bytanchan.com 上 發布 。
翻譯自: https://uxdesign.cc/creating-your-source-of-truth-with-text-styling-expressions-ee38bebe7c35
word文本樣式代碼樣式
總結
以上是生活随笔為你收集整理的word文本样式代码样式_使用文本样式表达创建真相来源的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: acunetix12及Awvs12.x安
- 下一篇: PS教程第十八课:放大缩小