Copy link to clipboard
Copied
is there a way I can simplify my work by creating an add effect module rather than creating line-by-line code for each effect like this?
1: i want to create a module and call it from button click
somefunction(effect name),selected layer
somefunction(BCC Temporal Blur)selected layer
rather than creating big lines of codes under button click below
currently, i have code like this to apply or add
myComp = app.project.activeItem;
mySolid = myComp.layers.addSolid([0,.8,.4], "BG", myComp.width, myComp.height,1);
mySolid.startTime = 0
myEffect = mySolid.property("Effects").addProperty("Power Stroke");
app.endUndoGroup();
apply effect on the selected layer
var myComp = app.project.activeItem;
var preCompLayer = myComp.selectedLayers[0];
preCompLayer.property("Effects").addProperty("BCC Velocity Remap");
Copy link to clipboard
Copied
maybe you can help fix this?
function applyfxx(fxx,selected layer) {
var myComp = app.project.activeItem;
var preCompLayer = myComp.selectedLayers[0];
preCompLayer.property("Effects").addProperty(fxx);
}
Copy link to clipboard
Copied
function applyfxx(fxx) {
var myComp = app.project.activeItem;
var preCompLayer = myComp.selectedLayers[0];
preCompLayer.property("Effects").addProperty(fxx);
}
applyfxx("VC Orb");
is this better can it be more better maybe call applyfxx from button click this way it shortens codes accross the project
Copy link to clipboard
Copied
function applyfxx(fxx) {
var myComp = app.project.activeItem;
var curItem = app.project.activeItem;
var selectedLayers = curItem.selectedLayers;
var selectedProperties = app.project.activeItem.selectedProperties;
var preCompLayer = myComp.selectedLayers[0];
if (selectedLayers == 0){
alert("Please Select at least one Layer");
return;
}
preCompLayer.property("Effects").addProperty(fxx);
}
// on selected layer
applyfxx("VC Orb");
Copy link to clipboard
Copied
Not sure what exactly you want to improve here.
If you look for a very efficient and fast way to create these kinds of these "a little bit more than a basic preset in one click" tools, Automation Blocks is a great solution. Much faster than writing the code manually. See this tutorial series for an example:
Automation Blocks is currently available as free, public beta until end of July.
Copy link to clipboard
Copied
thanks for the suggestion mathias but am building a script for public and my self and i just needed support buddy with the code i have.