ExtendScript的UnitValue [英] ExtendScript's UnitValue
问题描述
因此,我一生都找不到ExtendScript的UnitValue对象的组件的明细分类。我发现的每个来源都与Adobe有关,并且没有解释。我真的很想在上面找到完整的参考,但是如果没人能找到它,我至少需要回答一些有关它的问题。
首先,它的构造函数是什么?
我看过 UnitValue(10,'px')
这是有道理的,但我也看过 UnitValue(20,20)
第二,如何从一个单位转换为另一单位?
第三,如何找到其价值和单位? />
我想我已经看过 uv.value
了,但是什么都没得到
最后,正如我的标签所示,当然,这是针对Adobe的,因为我从未见过或听说过任何其他使用ExtendScript的程序。
So I can't find, for the life of me, a clear breakdown of the components of ExtendScript's UnitValue object. Every source I found had something to do with Adobe, and didn't explain it. I'd really like to have a full reference on it, but if no one can find one, I need at least a few questions answered concerning it.
First, what are its constructors?
I've seen UnitValue(10,'px')
which makes sense, but I've also seen UnitValue(20,20)
Second, how can you convert from one unit to another?
Third, how can you find its value and its unit?
I think I've seen uv.value
but nothing getting the units
Lastly, as my tags indicate, this is for Adobe, of course, since I've never seen or heard of any other program that uses ExtendScript.
推荐答案
UnitValue 在 Adobe JavaScript工具指南中进行了记录。
特别是,您创建一个对象,其中 v = new UnitValue(number,unit)
,其中 unit
是一个字符串值,例如 in
(英寸), mm
(毫米), pt
(点), px
(像素)等。
In particular, you create an object with v = new UnitValue(number, unit)
, where unit
is a string value like in
(inch), mm
(millimeter), pt
(point), px
(pixel), etc.
将UnitValue转换为实际数字,请使用 as
方法,例如 v.as( cm)
可以将 v
转换为厘米。
To convert a UnitValue to an actual number, use the as
method, e.g. v.as("cm")
to convert v
into centimeters.
这篇关于ExtendScript的UnitValue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!