Skip to content

Instantly share code, notes, and snippets.

@aescripts
Created November 27, 2017 23:36
Show Gist options
  • Save aescripts/b28f0e74f945589ed88e1546ab0fb5d9 to your computer and use it in GitHub Desktop.
Save aescripts/b28f0e74f945589ed88e1546ab0fb5d9 to your computer and use it in GitHub Desktop.
François Tarlier #AfterEffects #Script #KBar it will set a defined value on a defined properties at the current time of the comp
// it will set a defined value on a defined properties at the current time of the comp
/*********************************************************
PROPERTY VALUE AT CURRENT TIME
snippet for After Effects
made for ft-Toolbar http://aescripts.com/ft-toolbar/ or KBar https://aescripts.com/kbar
http://www.francois-tarlier.com
*********************************************************/
// this snippet will set a defined value on a defined properties at the current time of the comp
// add this code to a JAVASCRIPT button in ft-toolbar
// SET myValue like you wish
// SET myProperty with the one you want to affect
// myValue is the value which will be applied to the selected properties
// the value could be one of the following (just un-comment one of them) :
// var myValue = 0.0; // a float number
// var myValue = [0.5 ,10.0]; // an array of 2 elements - for instance X & Y axis
// var myValue = [0.5 , 4.0 , 7.0]; // an array of 3 elements - for instance X, Y & Z axis
// var myValue = [1.0 , 1.0 , 1.0,1.0]; // an array of 4 elements - for instance a color as RGBA
var myValue = 100; // a integer number
// myProperty is the property of the layer you want to affect
// make sure myValue is the proper kind of value for the property your are choosing.
var myProperty = "opacity"; //could be opacity, rotation, position,...
var ftTb_MyComp = app.project.activeItem; // our current selected & opened comp
if(ftTb_MyComp && ftTb_MyComp.selectedLayers.length > 0){ // if a comp is selected
for(var i = 0 ; i < ftTb_MyComp.selectedLayers.length; i++){ // go trough each selected layers
var ftTb_currentLayer = ftTb_MyComp.selectedLayers[i];
ftTb_currentLayer.property(myProperty).setValueAtTime(ftTb_MyComp.time,myValue);
};
}else{
alert("At least one layer must be selected");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment