- this snippet will set a defined value on the selected properties at the current time of the comp
- Language
- JavaScript
- Tags
- aescripts aftereffects afterfx ft-toolbar
- Favorited By
Value at Current Time for ft-toolbar's button in After Effects
1 /*********************************************************
2 VALUE AT CURRENT TIME
3 snippet for After Effects
4 made for ft-Toolbar http://aescripts.com/ft-toolbar/
5 http://www.francois-tarlier.com
6 *********************************************************/
7
8 // this snippet will set a defined value on the selected properties at the current time of the comp
9
10 // add this code to a JAVASCRIPT button in ft-toolbar
11 // SET myValue like you wish
12
13
14
15 // myValue is the value which will be applied to the selected properties
16 // the value could be one of the following (just un-comment one of them) :
17 var myValue = 1.0; // a float number
18 // var myValue = 100; // a integer number
19 //var myValue = [0.5 ,10.0]; // an array of 2 elements - for instance X & Y axis
20 // var myValue = [0.5 , 4.0 , 7.0]; // an array of 3 elements - for instance X, Y & Z axis
21 // var myValue = [1.0 , 1.0 , 1.0,1.0]; // an array of 4 elements - for instance a color as RGBA
22
23
24
25 var ftTb_MyComp = app.project.activeItem; // our current selected & opened comp
26 if(ftTb_MyComp && ftTb_MyComp.selectedLayers[0].selectedProperties[0]){ // if a comp and at least one property is selected
27 for(var i = 0 ; i < ftTb_MyComp.selectedLayers.length; i++){ // go trough each selected layers
28 var ftTb_currentLayer = ftTb_MyComp.selectedLayers[i];
29
30 for(var j = 0 ; j < ftTb_currentLayer.selectedProperties.length; j++){ // go through each selected properties
31 var ftTb_currentProperty = ftTb_currentLayer.selectedProperties[j];
32 var valueType = ftTb_currentProperty.propertyValueType; // check which kind of value is our selected property (1D, 2D, 3D or Color ?)
33
34 if(valueType == PropertyValueType.OneD && typeof myValue == "number"){ // if the selected Property and myValue are the same type (float or int)
35 ftTb_currentProperty.setValueAtTime(ftTb_MyComp.time,myValue); // set myValue at the current time
36
37 }else if(valueType == PropertyValueType.TwoD_SPATIAL || valueType == PropertyValueType.TwoD && myValue.length == 2){ // if the selected Property and myValue are the same type (array of 2 element (ie X,Y))
38 ftTb_currentProperty.setValueAtTime(ftTb_MyComp.time,myValue); // set myValue at the current time
39
40 }else if(valueType == PropertyValueType.ThreeD_SPATIAL || valueType == PropertyValueType.ThreeD && myValue.length == 3){ // if the selected Property and myValue are the same type (array of 3 element (ie X,Y,Z))
41 ftTb_currentProperty.setValueAtTime(ftTb_MyComp.time,myValue); // set myValue at the current time
42
43 }else if(valueType == PropertyValueType.COLOR && myValue.length == 4){ // if the selected Property and myValue are the same type (array of 4 element (ie RGBA))
44 ftTb_currentProperty.setValueAtTime(ftTb_MyComp.time,myValue); // set myValue at the current time
45 };
46 };
47 };
48 }else{
49 alert("properties of an effect or a layer has to be selected");
50 };
Comments
Sign in to leave a comment.

