Adobe 12040118 - After Effects Standard Using Manual page 133

Using help
Hide thumbs Also See for 12040118 - After Effects Standard:
Table of Contents

Advertisement

Help
Using Help
2
Getting and setting the value of a position
position has propertyValueType of ThreeD_SPATIAL and is stored as an array of three floats.
var myProper t y = myLayer. position;
myProper t y.setValue([10,30,0]);
// T his new v a r ia ble my Po sitio n be an a r r ay of 3 floats:
var myPosition = my Proper t y.value;
Changing the value of a mask shape to be open instead of closed
3
var myMask = my layer. ma sk(1);
var myPrope r t y = my Ma sk .ma sk Sh a pe ;
myShape = myProper t y.value;
my S h a p e . c l o s e d = f a l s e ;
myProper t y.setValue(myShape);
Getting the value of a color at a particular time
4
A color is stored as an array of four floats (r,g,b,opacity). The following code sets the value of the red
component of a light's color at time 4 to be half of that at time 2:
var myProper t y = myLig ht.color ;
var colorValue = my Proper t y.valueAtTime(2,t r ue);
colorValue[0] = 0.5 * colorValue[0];
myProper t y.setValueAtTime(4,colorValue);
How to check that a scale calculated by an expression at time 3.5 is the expected value of [10,50]
5
var my Proper t y = myLayer.scale;
// false value of preExpression means e v aluate the ex pression
var scaleValue = myProper t y.valueAtTime(3.5,false);
if (scaleValue[0] == 10 && scaleValue[1] == 50) {
aler t("hur r ay");
e l s e {
aler t("oops");
}
Keyframing a rotation from 0 to 90 and back again
6
The animation is 10 seconds, and the middle keyframe is at the 5 second mark. Rotation properties are stored
as a OneD value.
myProper t y = myLayer.rotation;
myProper t y.setValueAtTime(0, 0);
myProper t y.setValueAtTime(5, 90);
myProper t y.setValueAtTime(10, 0);
Changing the keyframe values for the first three keyframes of some source text
7
myProper t y = my TextLayer.source Text;
i f ( my Prop e r t y.nu m Ke ys < 3 ) {
aler t("er ror, I thoug ht there were 3 ke y fr ames");
}
myProper t y.setValueAtKe y(1, new TextDocument("ke y number 1");
myProper t y.setValueAtKe y(2, new TextDocument("ke y number 2");
Using Help
Reference
Back
133
Back
133

Advertisement

Table of Contents
loading

This manual is also suitable for:

After effects

Table of Contents