跳转到内容

属性对象

app.project.item(index).layer(index).propertySpec

Property对象包含图层特定AE属性的值、关键帧和表达式信息。AE属性是指图层中效果、遮罩或变换的可动画化值。关于如何访问属性的示例,请参阅PropertyBase对象PropertyGroup.property()

Property是PropertyBase的子类。除了下面列出的方法外,PropertyBase的所有方法和属性在操作Property时都可用。

获取和设置不透明度的值:

var myProperty = myLayer.opacity;
// 不透明度的propertyValueType为OneD,存储为浮点数
myProperty.setValue(50); // 将不透明度设置为50%
// 变量myOpacity是一个浮点值
var myOpacity = myProperty.value;

获取和设置位置的值:

var myProperty = myLayer.position;
// 位置的propertyValueType为ThreeD_SPATIAL,存储为3个浮点数的数组
myProperty.setValue([10.0, 30.0, 0.0]);
// 变量myPosition是一个包含3个浮点数的数组
var myPosition = myProperty.value;

将遮罩形状的值更改为开放而非闭合:

var myMask = mylayer.mask(1);
var myProperty = myMask.maskPath;
myShape = myProperty.value;
myShape.closed = false;
myProperty.setValue(myShape);

获取特定时间的颜色值。颜色存储为四个浮点数的数组[r, g, b, opacity]。这将时间4处灯光颜色的红色分量设置为时间2处的一半:

var myProperty = myLight.color;
var colorValue = myProperty.valueAtTime(2, true);
colorValue[0] = 0.5 * colorValue[0];
myProperty.setValueAtTime(4, colorValue);

检查表达式在时间3.5处计算的缩放是否为预期值[10,50]:

var myProperty = myLayer.scale;
// preExpression的false值表示评估表达式
var scaleValue = myProperty.valueAtTime(3.5, false);
if (scaleValue[0] === 10 && scaleValue[1] === 50) {
alert("hurray");
} else {
alert("oops");
}

将旋转从0关键帧到90再回到0。动画持续10秒,中间关键帧在5秒处。旋转属性存储为OneD值:

var myProperty = myLayer.rotation;
myProperty.setValueAtTime(0, 0);
myProperty.setValueAtTime(5, 90);
myProperty.setValueAtTime(10, 0);

更改某些源文本前三个关键帧的值:

var myProperty = myTextLayer.sourceText;
if (myProperty.numKeys < 3) {
alert("error, I thought there were 3 keyframes");
} else {
myProperty.setValueAtKey(1, newTextDocument("keynumber1"));
myProperty.setValueAtKey(2, newTextDocument("keynumber2"));
myProperty.setValueAtKey(3, newTextDocument("keynumber3"));
}

使用位置、缩放、颜色或源文本的便捷语法设置值:

// 这两者是等价的。第二个填充默认值0。
myLayer.position.setValue([20, 30, 0]);
myLayer.position.setValue([20, 30]);
// 这两者是等价的。第二个填充默认值100。
myLayer.scale.setValue([50, 50, 100]);
myLayer.scale.setValue([50, 50]);
// 这两者是等价的。第二个填充默认值1.0
myLight.color.setValue([0.8, 0.3, 0.1, 1.0]);
myLight.color.setValue([0.8, 0.3, 0.1]);
// 这两者是等价的。第二个创建一个TextDocument
myTextLayer.sourceText.setValue(newTextDocument("foo"));
myTextLayer.sourceText.setValue("foo");

app.project.item(index).layer(index).propertySpec.alternateSource

当以下情况时,值为null

  • 未为关联图层设置备用源。
  • 该属性不能用于设置备用源。

使用Property.canSetAlternateSource确定该属性是否为媒体替换基本属性。

所有媒体替换图层都有一个可以设置的备用源项。

当图层被添加到基本图形面板时,图层被”标记”为媒体替换(参见AVLayer.addToMotionGraphicsTemplate()AVLayer.addToMotionGraphicsTemplateAs())。

  • 如果存在,渲染工作流将在渲染图层时选择备用源。
  • 如果未设置图层的备用源,则使用媒体替换控件的源图层进行渲染(这是正常的工作流)。

使用Property.setAlternateSource()更改值。

AVItem对象;只读。


app.project.item(index).layer(index).propertySpec.canSetAlternateSource

测试该属性是否为支持媒体替换的基本属性。

如果该属性允许媒体替换,则返回true,否则返回false

布尔值;只读。


app.project.item(index).layer(index).propertySpec.canSetExpression

当为true时,命名属性的类型可以通过脚本设置其表达式。另请参阅Property expression属性。

布尔值;只读。


app.project.item(index).layer(index).propertySpec.canVaryOverTime

当为true时,命名属性可以随时间变化——即可以为此属性写入关键帧值或表达式。

布尔值;只读。


app.project.item(index).layer(index).propertySpec.dimensionsSeparated

当为true时,属性的维度表示为单独的属性。例如,如果图层的位置在时间轴面板中表示为X位置和Y位置属性,则位置属性将此属性设置为true

布尔值;读/写。


app.project.item(index).layer(index).essentialProperty.property(index).essentialPropertySource

基本属性对象上的实例属性,返回用于创建基本属性的原始源属性。

可以是:

  • 读/写Property对象,如果用于创建基本属性的源对象是Property
  • 读/写AVLayer对象,如果用于创建基本属性的源对象是媒体替换素材项
  • 如果在非基本属性上调用,则为null
var firstComp = app.project.item(1);
var opacityProp = firstComp.layer(1).property("Transform").property("Opacity");
opacityProp.addToMotionGraphicsTemplate(firstComp);
var secondComp = app.project.item(2);
secondComp.layers.add(firstComp);
var essentialOpacity = secondComp.layer(1).essentialProperty.property(1);
if (essentialOpacity.essentialPropertySource == opacityProp) {
alert("You can get the source Property from an Essential Property!");
}

app.project.item(index).layer(index).propertySpec.expression

命名属性的表达式。仅当命名属性的canSetExpressiontrue时可写。当您为此属性指定值时,字符串会被评估。

  • 如果字符串包含有效表达式,expressionEnabled变为true。
  • 如果字符串不包含有效表达式,会生成错误,且expressionEnabled变为false
  • 如果将属性设置为空字符串,expressionEnabled变为false,但不会生成错误。

字符串;如果命名属性的canSetExpressiontrue,则可读/写。


app.project.item(index).layer(index).propertySpec.expressionEnabled

当为true时,命名属性使用其关联的表达式生成值。当为false时,使用属性的关键帧信息或静态值。仅当命名属性的canSetExpressiontrueexpression包含有效表达式字符串时,才能将此属性设置为true

布尔值;读/写。


app.project.item(index).layer(index).propertySpec.expressionError

包含最近在expression中设置的字符串评估生成的错误(如果有)。如果未指定表达式字符串,或如果最后一个表达式字符串评估无误,则包含空字符串("")

字符串;只读。


app.project.item(index).layer(index).propertySpec.hasMax

当为true时,命名属性有允许的最大值;否则为false

布尔值;只读。


app.project.item(index).layer(index).propertySpec.hasMin

当为true时,命名属性有允许的最小值;否则为false

布尔值;只读。


app.project.item(index).layer(index).propertySpec.isDropdownEffect

当为true时,该属性是下拉菜单控制效果的菜单属性,并且可以使用setPropertyParameters更新其项目。

appliedEffect.property("Menu").isDropdownEffect; // true
appliedEffect.property("Color").isDropdownEffect; // false
appliedEffect.property("Feather").isDropdownEffect; // false

布尔值;只读。


app.project.item(index).layer(index).propertySpec.isSeparationFollower

当为true时,该属性表示多维属性的其中一个分离维度。例如,X位置属性将此属性设置为true

布尔值;只读。


app.project.item(index).layer(index).propertySpec.isSeparationLeader

当为true时,该属性是多维的且可以分离。例如,位置属性将此属性设置为true

布尔值;只读。


app.project.item(index).layer(index).propertySpec.isSpatial

当为true时,命名属性定义空间值。例如位置和效果点控制。

布尔值;只读。


app.project.item(index).layer(index).propertySpec.isTimeVarying

当为true时,命名属性随时间变化——即它具有关键帧或启用的表达式。当此属性为true时,属性canVaryOverTime也必须为true。

布尔值;只读。


app.project.item(index).layer(index).propertySpec.maxValue

命名属性的允许最大值。如果hasMax属性为false,则会发生异常并生成错误。

浮点值;只读。


app.project.item(index).layer(index).propertySpec.minValue

命名属性的允许最小值。如果hasMin属性为false,则会发生异常并生成错误。

浮点值;只读。


app.project.item(index).layer(index).propertySpec.numKeys

命名属性中的关键帧数量。如果值为0,则该属性未被关键帧化。

整数;只读。


app.project.item(index).layer(index).propertySpec.propertyIndex

命名属性的位置索引。第一个属性位于索引位置1。

整数;只读。


app.project.item(index).layer(index).propertySpec.propertyValueType

命名属性中存储的值的类型。PropertyValueType枚举为可以存储在属性中或从属性中检索的每种数据类型都有一个值。每种类型的数据以不同的结构存储和检索。所有属性对象都根据这些类别之一存储数据。例如,3D空间属性(如图层的位置)存储为三个浮点值的数组。设置位置值时,传入这样的数组,如下所示:mylayer.property("position").setValue([10, 20, 0]);

相比之下,形状属性(如图层的遮罩形状)存储为Shape对象。设置形状值时,传入Shape对象,如下所示:

var myShape = new Shape();
myShape.vertices = [[0,0], [0,100], [100,100], [100,0]];
var myMask = mylayer.property("ADBE Mask Parade").property(1);
myMask.property("ADBE Mask Shape").setValue(myShape);

PropertyValueType枚举值;读/写。其中之一:

  • PropertyValueType.NO_VALUE:不存储数据。
  • PropertyValueType.ThreeD_SPATIAL:三个浮点位置值的数组。例如,锚点值可能是[10.0, 20.2, 0.0]
  • PropertyValueType.ThreeD:三个浮点定量值的数组。例如,缩放值可能是[100.0, 20.2, 0.0]
  • PropertyValueType.TwoD_SPATIAL:两个浮点位置值的数组。例如,锚点值可能是[5.1, 10.0]
  • PropertyValueType.TwoD:两个浮点定量值的数组。例如,缩放值可能是[5.1, 100.0]
  • PropertyValueType.OneD:一个浮点值。
  • PropertyValueType.COLOR:四个浮点值的数组,范围在[0.0..1.0]。例如,[0.8, 0.3, 0.1, 1.0]
  • PropertyValueType.CUSTOM_VALUE:自定义属性值,如Levels效果的Histogram属性。
  • PropertyValueType.MARKERMarkerValue对象
  • PropertyValueType.LAYER_INDEX:整数;值为0表示无图层。
  • PropertyValueType.MASK_INDEX:整数;值为0表示无遮罩。
  • PropertyValueType.SHAPEShape对象
  • PropertyValueType.TEXT_DOCUMENTTextDocument对象

app.project.item(index).layer(index).propertySpec.selectedKeys

命名属性中所有选定关键帧的索引。如果未选择关键帧,或属性没有关键帧,则返回空数组。

整数数组;只读。


app.project.item(index).layer(index).propertySpec.separationDimension

对于分离的跟随者,表示其在多维领导者中的维度编号。第一个维度从0开始。例如,Y位置属性的separationDimension值为1;X位置属性的值为0。

整数;只读。


app.project.item(index).layer(index).propertySpec.separationLeader

此分离跟随者的原始多维属性。例如,如果当前属性是Y位置,则此属性的值指向位置属性。

Property对象;只读。


app.project.item(index).layer(index).propertySpec.unitsText

值所表示单位的文本描述。

字符串;只读。


app.project.item(index).layer(index).propertySpec.value

当前时间命名属性的值。

  • 如果expressionEnabledtrue,返回评估的表达式值。
  • 如果有关键帧,返回当前时间的关键帧值。
  • 否则,返回静态值。

返回的值的类型取决于属性值类型。参见Property对象的示例

适合属性类型的值(参见Property.propertyValueType);只读。


app.project.item(index).layer(index).propertySpec.addKey(time)

在指定时间向命名属性添加新的关键帧或标记,并返回新关键帧的索引。

参数类型描述
time浮点数值添加关键帧的时间(以秒为单位)。合成开始时间为0。

整数;新关键帧或标记的索引。


app.project.item(index).layer(index).propertySpec.addToMotionGraphicsTemplate(comp)

将属性添加到指定合成的基本图形面板中。

如果属性成功添加则返回 true,否则返回 false

如果属性未被添加,可能是因为它不是受支持的属性类型,或该属性已添加到该合成的EGP中。如果属性无法添加到EGP,After Effects 将显示警告对话框。

使用 Property.canAddToMotionGraphicsTemplate() 方法测试属性是否可以添加到动态图形模板。

参数类型描述
compCompItem要添加属性的目标合成。

布尔值。


app.project.item(index).layer(index).propertySpec.addToMotionGraphicsTemplateAs(comp, name)

将属性添加到指定合成的基本图形面板中,并可自定义EGP属性名称。

如果属性成功添加则返回 true,否则返回 false

如果属性未被添加,可能是因为它不是受支持的属性类型,或该属性已添加到该合成的EGP中。如果属性无法添加到EGP,After Effects 将显示警告对话框。

使用 Property.canAddToMotionGraphicsTemplate() 方法测试属性是否可以添加到动态图形模板。

参数类型描述
compCompItem要添加属性的目标合成。
name字符串新名称。

布尔值。


app.project.item(index).layer(index).propertySpec.canAddToMotionGraphicsTemplate(comp)

测试属性是否可以添加到指定合成的基本图形面板中。

如果可以添加则返回 true,否则返回 false

如果属性无法添加,可能是因为它不是受支持的属性类型,或该属性已添加到该合成的EGP中。如果属性无法添加到EGP,After Effects 将显示警告对话框。

支持的属性类型包括:

  • 复选框
  • 颜色
  • 数值滑块(即单值数值属性,如变换 > 不透明度或滑块控制表达式控制效果)
  • 源文本
参数类型描述
compCompItem要添加属性的目标合成。

布尔值。


app.project.item(index).layer(index).propertySpec.getSeparationFollower(dim)

对于已分离的多维属性,检索特定的跟随属性。例如,可以在位置属性上使用此方法来访问分离的X位置和Y位置属性。

参数类型描述
dim整数维度编号(从0开始)。

属性对象,如果属性不是多维或没有指定维度则返回错误。


app.project.item(index).layer(index).propertySpec.isInterpolationTypeValid(type)

如果命名属性可以使用指定的关键帧插值类型进行插值,则返回 true

KeyframeInterpolationType 枚举值;可选:

  • KeyframeInterpolationType.LINEAR
  • KeyframeInterpolationType.BEZIER
  • KeyframeInterpolationType.HOLD

布尔值。


app.project.item(index).layer(index).propertySpec.keyInInterpolationType(keyIndex)

返回指定关键帧的”入”插值类型。

参数类型描述
keyIndex整数,范围 [1..numKeys]关键帧索引,由 addKeynearestKeyIndex 返回。

KeyframeInterpolationType 枚举值;可选:

  • KeyframeInterpolationType.LINEAR
  • KeyframeInterpolationType.BEZIER
  • KeyframeInterpolationType.HOLD

app.project.item(index).layer(index).propertySpec.keyInSpatialTangent(keyIndex)

如果命名属性是空间属性(即值类型为 TwoD_SPATIALThreeD_SPATIAL),则返回指定关键帧的传入空间切线。

参数类型描述
keyIndex整数,范围 [1..numKeys]关键帧索引,由 addKeynearestKeyIndex 返回。

浮点值数组:

  • 如果属性值类型为 PropertyValueType.TwoD_SPATIAL,数组包含2个浮点值。
  • 如果属性值类型为 PropertyValueType.ThreeD_SPATIAL,数组包含3个浮点值。
  • 如果属性值类型不是上述类型,则生成异常。

app.project.item(index).layer(index).propertySpec.keyInTemporalEase(keyIndex)

返回指定关键帧的传入时间缓动。

参数类型描述
keyIndex整数,范围 [1..numKeys]关键帧索引,由 addKeynearestKeyIndex 返回。

KeyframeEase 对象 数组:

  • 如果属性值类型为 PropertyValueType.TwoD,数组包含2个对象。
  • 如果属性值类型为 PropertyValueType.ThreeD,数组包含3个对象。
  • 对于其他值类型,数组包含1个对象。

app.project.item(index).layer(index).propertySpec.keyLabel(keyIndex)

关键帧的标签颜色。颜色用数字表示(0表示无颜色,1到16表示标签首选项中预设颜色之一)。

只读。关键帧颜色标签可以通过 setLabelAtKey 设置。

参数类型描述
keyIndex整数,范围 [1..numKeys]关键帧索引,由 addKeynearestKeyIndex 返回。

整数(0到16);只读。


app.project.item(index).layer(index).propertySpec.keyOutInterpolationType(keyIndex)

返回指定关键帧的”出”插值类型。

参数类型描述
keyIndex整数,范围 [1..numKeys]关键帧索引,由 addKeynearestKeyIndex 返回。

KeyframeInterpolationType 枚举值;可选:

  • KeyframeInterpolationType.LINEAR
  • KeyframeInterpolationType.BEZIER
  • KeyframeInterpolationType.HOLD

app.project.item(index).layer(index).propertySpec.keyOutSpatialTangent(keyIndex)

返回指定关键帧的传出空间切线。

参数类型描述
keyIndex整数,范围 [1..numKeys]关键帧索引,由 addKeynearestKeyIndex 返回。

浮点值数组:

  • 如果属性值类型为 PropertyValueType.TwoD_SPATIAL,数组包含2个浮点值。
  • 如果属性值类型为 PropertyValueType.ThreeD_SPATIAL,数组包含3个浮点值。
  • 如果属性值类型不是上述类型,则生成异常。

app.project.item(index).layer(index).propertySpec.keyOutTemporalEase(keyIndex)

返回指定关键帧的传出时间缓动。

参数类型描述
keyIndex整数,范围 [1..numKeys]关键帧索引,由 addKeynearestKeyIndex 返回。

KeyframeEase 对象数组:

  • 如果属性值类型为 PropertyValueType.TwoD,数组包含2个对象。
  • 如果属性值类型为 PropertyValueType.ThreeD,数组包含3个对象。
  • 对于其他值类型,数组包含1个对象。

app.project.item(index).layer(index).propertySpec.keyRoving(keyIndex)

如果指定关键帧处于浮动状态则返回true。属性中的第一个和最后一个关键帧不能浮动;如果尝试为这些关键帧设置浮动,操作将被忽略,且keyRoving()继续返回false。如果属性值类型既不是TwoD_SPATIAL也不是ThreeD_SPATIAL,则会抛出异常。

参数类型描述
keyIndex整数,范围[1..numKeys]关键帧索引,由addKeynearestKeyIndex返回。

布尔值。


app.project.item(index).layer(index).propertySpec.keySelected(keyIndex)

如果指定关键帧被选中则返回true

参数类型描述
keyIndex整数,范围[1..numKeys]关键帧索引,由addKeynearestKeyIndex返回。

布尔值。


app.project.item(index).layer(index).propertySpec.keySpatialAutoBezier(keyIndex)

如果指定关键帧具有空间自动贝塞尔插值则返回true。(仅当keySpatialContinuous(keyIndex)也为true时,此插值类型才会影响此关键帧。)如果属性值类型既不是TwoD_SPATIAL也不是ThreeD_SPATIAL,则会抛出异常。

参数类型描述
keyIndex整数,范围[1..numKeys]关键帧索引,由addKeynearestKeyIndex返回。

布尔值。


app.project.item(index).layer(index).propertySpec.keySpatialContinuous(keyIndex)

如果指定关键帧具有空间连续性则返回true。如果属性值类型既不是TwoD_SPATIAL也不是ThreeD_SPATIAL,则会抛出异常。

参数类型描述
keyIndex整数,范围[1..numKeys]关键帧索引,由addKeynearestKeyIndex返回。

布尔值。


app.project.item(index).layer(index).propertySpec.keyTemporalAutoBezier(keyIndex)

如果指定关键帧具有时间自动贝塞尔插值则返回true。仅当关键帧插值类型对keyInInterpolationType(keyIndex)keyOutInterpolationType(keyIndex)都是KeyframeInterpolationType.BEZIER时,时间自动贝塞尔插值才会影响此关键帧。

参数类型描述
keyIndex整数,范围[1..numKeys]关键帧索引,由addKeynearestKeyIndex返回。

布尔值。


app.project.item(index).layer(index).propertySpec.keyTemporalContinuous(keyIndex)

如果指定关键帧具有时间连续性则返回true。仅当关键帧插值类型对keyInInterpolationType(keyIndex)keyOutInterpolationType(keyIndex)都是KeyframeInterpolationType.BEZIER时,时间连续性才会影响此关键帧。

参数类型描述
keyIndex整数,范围[1..numKeys]关键帧索引,由addKeynearestKeyIndex返回。

布尔值。


app.project.item(index).layer(index).propertySpec.keyTime(keyIndex) app.project.item(index).layer(index).propertySpec.keyTime(markerComment)

查找指定的关键帧或标记并返回其出现的时间。如果找不到与参数匹配的关键帧或标记,此方法会抛出异常并显示错误。

参数类型描述
keyIndex整数,范围[1..numKeys]关键帧索引,由addKeynearestKeyIndex返回。
markerComment字符串附加到标记的注释(参见MarkerValue.comment属性)。

浮点数值。


app.project.item(index).layer(index).propertySpec.keyValue(keyIndex)

app.project.item(index).layer(index).propertySpec.keyValue(markerComment)

查找指定的关键帧或标记并返回其当前值。如果找不到与参数匹配的关键帧或标记,此方法会抛出异常并显示错误。

参数类型描述
keyIndex整数,范围[1..numKeys]关键帧索引,由addKeynearestKeyIndex返回。
markerComment字符串附加到标记的注释(参见MarkerValue.comment属性)。

返回与PropertyValueType对应的类型的值。


app.project.item(index).layer(index).propertySpec.nearestKeyIndex(time)

返回最接近指定时间的关键帧索引。

参数类型描述
time浮点数值时间,以秒为单位。合成的开始为0。

整数。


app.project.item(index).layer(index).propertySpec.removeKey(keyIndex)

从指定属性中移除指定的关键帧。如果不存在具有指定索引的关键帧,则抛出异常并显示错误。移除关键帧后,剩余的索引号会发生变化。要移除多个关键帧,必须从最高索引号开始,逐步向下移除最低索引号,以确保每次移除后剩余的索引仍引用相同的关键帧。

参数类型描述
keyIndex整数,范围[1..numKeys]关键帧索引,由addKeynearestKeyIndex返回。

无。


app.project.item(index).layer(index).propertySpec.setAlternateSource(newSource)

设置此属性的备用源。

Property对象和被调用的AVItem的输入参数需要兼容媒体替换才能使操作通过。

参数类型描述
newSourceAVItem对象新的源AVItem。

无。


app.project.item(index).layer(index).propertySpec.setInterpolationTypeAtKey(keyIndex, inType[, outType])

设置指定关键帧的inout插值类型。

参数类型描述
keyIndex整数关键帧索引,范围[1..numKeys],由addKeynearestKeyIndex返回。
inTypeKeyframeInterpolationType枚举传入插值类型。可选值:
- KeyframeInterpolationType.LINEAR
- KeyframeInterpolationType.BEZIER
- KeyframeInterpolationType.HOLD
outTypeKeyframeInterpolationType枚举可选。传出插值类型。如果未提供,则’out’类型设置为inType值。可选值:
- KeyframeInterpolationType.LINEAR
- KeyframeInterpolationType.BEZIER
- KeyframeInterpolationType.HOLD

无。


app.project.item(index).layer(index).propertySpec.setLabelAtKey(keyIndex, labelIndex)

设置关键帧的标签颜色。颜色由其编号表示(0表示无颜色,1到16表示标签首选项中的预设颜色之一)。

参数类型描述
keyIndex整数,范围[1..numKeys]关键帧索引,由addKeynearestKeyIndex返回。
labelIndex整数,范围[0..16]新标签值的索引。

无。


app.project.item(index).layer(index).propertySpec.setPropertyParameters(items)

设置下拉菜单控件的菜单属性的参数。此方法将用提供的字符串数组覆盖现有的菜单项集。

  • 下拉菜单控件效果的菜单属性是唯一允许设置参数的属性。
  • 要检查属性是否允许设置参数,请在调用此方法之前使用isDropdownEffect进行检查。
  • 此方法失败时会抛出异常。
参数类型描述
items字符串数组将替换下拉菜单控件中现有菜单项的值。
- 仅允许字符串。
- 不允许空项目字符串。
- 不允许重复的项目字符串。
- 项目字符串中不允许字符"\"
- 可以将字符串"(-"指定为项目字符串之一,以在下拉菜单中创建分隔线。分隔线将各自占用一个索引。
var dropdownItems = [
"第一个项目",
"第二个项目",
"(-",
"另一个项目",
"最后一个项目"
];
var dropdownEffect = layer.property("ADBE Effect Parade").addProperty("ADBE Dropdown Control");
dropdownEffect.property(1).setPropertyParameters(dropdownItems);

Property对象,更新后的下拉菜单控件的菜单属性。


app.project.item(index).layer(index).propertySpec.setRovingAtKey(keyIndex, newVal)

为指定关键帧开启或关闭浮动状态。属性中的第一个和最后一个关键帧不能浮动;如果尝试为这些关键帧设置浮动,操作将被忽略,且keyRoving()继续返回false。如果属性值类型既不是TwoD_SPATIAL也不是ThreeD_SPATIAL,则会抛出异常。

参数类型描述
keyIndex整数,范围[1..numKeys]关键帧索引,由addKeynearestKeyIndex返回。
newVal布尔值true开启浮动,false关闭浮动。

无。

app.project.item(index).layer(index).propertySpec.setSelectedAtKey(keyIndex, onOff)

选中或取消选中指定的关键帧。

参数类型描述
keyIndex整数,范围在 [1..numKeys] 之间关键帧的索引,由 addKeynearestKeyIndex 返回。
onOff布尔值true 表示选中关键帧,false 表示取消选中。

无。


app.project.item(index).layer(index).propertySpec.setSpatialAutoBezierAtKey(keyIndex, newVal)

为指定的关键帧开启或关闭空间自动贝塞尔插值。如果属性值类型既不是 TwoD_SPATIAL 也不是 ThreeD_SPATIAL,则会抛出异常。

参数类型描述
keyIndex整数,范围在 [1..numKeys] 之间关键帧的索引,由 addKeynearestKeyIndex 返回。
newVal布尔值true 表示开启空间自动贝塞尔插值,false 表示关闭。

无。


app.project.item(index).layer(index).propertySpec.setSpatialContinuousAtKey(keyIndex, newVal)

为指定的关键帧开启或关闭空间连续性。如果属性值类型既不是 TwoD_SPATIAL 也不是 ThreeD_SPATIAL,则会抛出异常。

参数类型描述
keyIndex整数,范围在 [1..numKeys] 之间关键帧的索引,由 addKeynearestKeyIndex 返回。
newVal布尔值true 表示开启空间自动贝塞尔插值,false 表示关闭。

无。


app.project.item(index).layer(index).propertySpec.setSpatialTangentsAtKey(keyIndex, inTangent[, outTangent])

为指定的关键帧设置输入和输出的切线向量。如果属性值类型既不是 TwoD_SPATIAL 也不是 ThreeD_SPATIAL,则会抛出异常。

参数类型描述
keyIndex整数关键帧的索引,范围在 [1..numKeys] 之间,由 addKeynearestKeyIndex 返回。
inTangent包含 2 或 3 个浮点值的数组。输入切线向量。
- 如果属性值类型是 PropertyValueType.TwoD_SPATIAL,数组包含 2 个值。
- 如果属性值类型是 PropertyValueType.ThreeD_SPATIAL,数组包含 3 个值。
outTangent包含 2 或 3 个浮点值的数组。可选。输出切线向量。如果未提供,输出切线将设置为与输入切线相同的值。
- 如果属性值类型是 PropertyValueType.TwoD_SPATIAL,数组包含 2 个值。
- 如果属性值类型是 PropertyValueType.ThreeD_SPATIAL,数组包含 3 个值。

无。


app.project.item(index).layer(index).propertySpec.setTemporalAutoBezierAtKey(keyIndex, newVal)

为指定的关键帧开启或关闭时间自动贝塞尔插值。当开启时,仅当 keySpatialContinuous(keyIndex) 也为 true 时才会影响此关键帧。

参数类型描述
keyIndex整数,范围在 [1..numKeys] 之间关键帧的索引,由 addKeynearestKeyIndex 返回。
newVal布尔值true 表示开启时间自动贝塞尔插值,false 表示关闭。

无。


app.project.item(index).layer(index).propertySpec.setTemporalContinuousAtKey(keyIndex, newVal)

为指定的关键帧开启或关闭时间连续性。当时间连续性开启时,仅当关键帧插值类型为 KeyframeInterpolationType.BEZIER(对于 keyInInterpolationType(keyIndex)keyOutInterpolationType(keyIndex))时才会影响此关键帧。

参数类型描述
keyIndex整数,范围在 [1..numKeys] 之间关键帧的索引,由 addKeynearestKeyIndex 返回。
newVal布尔值true 表示开启时间自动贝塞尔插值,false 表示关闭。

无。


app.project.item(index).layer(index).propertySpec.setTemporalEaseAtKey(keyIndex, inTemporalEase[, outTemporalEase])

为指定的关键帧设置输入和输出的时间缓动。参见 KeyframeEase 对象

参数类型描述
keyIndex整数关键帧的索引,范围在 [1..numKeys] 之间,由 addKeynearestKeyIndex 返回。
inTemporalEase包含 1、2 或 3 个 KeyframeEase 对象 的数组输入时间缓动。
- 如果属性值类型是 PropertyValueType.TwoD,数组包含 2 个对象。
- 如果属性值类型是 PropertyValueType.ThreeD,数组包含 3 个对象。
- 对于其他值类型,数组包含 1 个对象。
outTemporalEase包含 1、2 或 3 个 KeyframeEase 对象 的数组可选。输出时间缓动。如果未提供,输出缓动将设置为与输入缓动相同的值。
- 如果属性值类型是 PropertyValueType.TwoD,数组包含 2 个对象。
- 如果属性值类型是 PropertyValueType.ThreeD,数组包含 3 个对象。
- 对于其他值类型,数组包含 1 个对象。

无。


app.project.item(index).layer(index).propertySpec.setValue(newValue)

设置没有关键帧的属性的静态值。如果指定属性有关键帧,此方法会抛出异常并显示错误。要设置有关键帧的属性的值,请使用 Property.setValueAtTime()Property.setValueAtKey()

参数类型描述
newValue适合被设置属性类型的值;参见 Property.propertyValueType

无。


app.project.item(index).layer(index).propertySpec.setValueAtKey(keyIndex, newValue)

查找指定的关键帧并设置其值。如果指定属性没有关键帧,或没有指定索引的关键帧,此方法会抛出异常并显示错误。

参数类型描述
keyIndex整数,范围在 [1..numKeys] 之间关键帧的索引,由 addKeynearestKeyIndex 返回。
newValue适合被设置属性类型的值;参见 Property.propertyValueType

无。


app.project.item(index).layer(index).propertySpec.setValueAtTime(time, newValue)

在指定时间设置关键帧的值。如果指定时间当前不存在关键帧,则为指定属性创建一个新关键帧并设置其值。

参数类型描述
time浮点值设置值的时间,单位为秒。合成的开始时间为 0。
newValue适合被设置属性类型的值;参见 Property.propertyValueType

无。


app.project.item(index).layer(index).propertySpec.setValuesAtTimes(times, newValues)

在指定时间设置一组关键帧的值。如果指定时间当前不存在关键帧,则为指定属性创建一个新关键帧并设置其值。时间和值以数组形式提供;数组长度必须相同。

参数类型描述
times浮点值数组时间数组,单位为秒。合成的开始时间为 0。
newValues值数组适合被设置属性类型的值数组;参见 Property.propertyValueType

无。


app.project.item(index).layer(index).propertySpec.valueAtTime(time, preExpression)

指定属性在指定时间评估的值。注意返回值的类型不明确;它将根据评估的属性类型而有所不同。

参数类型描述
time浮点值评估值的时间,单位为秒。合成的开始时间为 0。
preExpression布尔值如果属性有表达式且此参数为 true,则返回指定时间的值而不应用表达式。当为 false 时,返回表达式在指定时间评估的结果。如果属性没有关联的表达式,则忽略此参数。

适合属性类型的值(参见第 138 页的“Property propertyValueType 属性”)。