Adobe 12040118 Using Help - Page 133
How to check that a scale calculated by an expression at time 3.5 is the expected value of [10
UPC - 718659361808
View all Adobe 12040118 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 133 highlights
Help Using Help Reference Back 133 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 myProperty = myLayer.position; myProper t y.setValue([10,30,0]); // This new variable myPosition be an array of 3 floats: var myPosition = myProperty.value; 3 Changing the value of a mask shape to be open instead of closed var myMask = mylayer.mask(1); var myProperty = myMask.maskShape; myShape = myProperty.value; myShape.closed = false; myProper t y.setValue(myShape); 4 Getting the value of a color at a particular time 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 myProperty = myLight.color; var colorValue = myProper t y.valueAtTime(2,t r ue); colorValue[0] = 0.5 * colorValue[0]; myProper t y.setValueAtTime(4,colorValue); 5 How to check that a scale calculated by an expression at time 3.5 is the expected value of [10,50] var myProperty = myLayer.scale; // false value of preExpression means evaluate the expression var scaleValue = myProper t y.valueAtTime(3.5,false); if (scaleValue[0] == 10 && scaleValue[1] == 50) { alert("hurray"); else { alert("oops"); } 6 Keyframing a rotation from 0 to 90 and back again The animation is 10 seconds, and the middle keyframe is at the 5 second mark. Rotation properties are stored as a OneD value. myProperty = myLayer.rotation; myProper t y.setValueAtTime(0, 0); myProper t y.setValueAtTime(5, 90); myProper t y.setValueAtTime(10, 0); 7 Changing the keyframe values for the first three keyframes of some source text myProper t y = my TextLayer.sourceText; if (myProperty.numKeys < 3) { alert("error, I thought there were 3 keyframes"); } my Proper t y.setValueAtKe y(1, new TextDocument("ke y number 1"); my Proper t y.setValueAtKe y(2, new TextDocument("ke y number 2"); Using Help Back 133