FORUMS: list search recent posts

How to create a DropDownList to select effect function ?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Emwa Sanya
How to create a DropDownList to select effect function ?
on Apr 13, 2016 at 6:43:44 pm
Last Edited By Emwa Sanya on Apr 14, 2016 at 11:11:01 pm

Hello ! I want to create a DropDownList, but I don`t know how to select effect function to DropDownList,

for example:

var myEffect = video.property("Effects").addProperty("Box Blur");
myEffect.property("Blur Radius").expression = 'thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")';


var myEffect = video.property("Effects").addProperty("Noise");
myEffect.property("Amount of Noise").expression = 'thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")';

Thank you in advance.

This is my code:

(function myScript(thisObj){ // Globals

var myScript = new Object(); // Store globals in an object
myScript.scriptName = "AudioAnimation";
myScript.scriptTitle = myScript.scriptName + " v 0.1";
myScript.strRun = {en: "Run"};
myScript.strType = {en: "Effects:"};
myScript.strTypeOpts = {en: '["Box Blur", "Noise", "TEST"]'};
myScript.strHelp = {en: "Help ?"};
myScript.strHelpText =
{
en: "HELP \n" +
"HELP HELP HELP.\n"
};
myScript.strAbout = {en: "About"};
myScript.strAboutText =
{
en: "Copyright (c) 2015-2016 redefinery Bla Bla Bla.\n" +
"All rights reserved.\n"
};

function myScript_localize(strVar)
{
return strVar["en"];
}


function myScript_buildUI(thisObj)
{
var pal = (thisObj instanceof Panel) ? thisObj : new Window("palette", myScript.scriptName, undefined, {resizeable:true});

if (pal !== null)
{
var res = "group {orientation: 'column',\
header: Group{orientation:'row',\
help: Button{text:'" + myScript_localize(myScript.strHelp) +"', alignment:['right','center'] },\
about: Button{text:'"+ myScript_localize(myScript.strAbout) +"', alignment:['right','center'] },\
},\
grp1: Group{orientation:'column',\
effect: StaticText { text:'" + myScript_localize(myScript.strType) + "' }, \
effectList:DropDownList{ properties:{items:" + myScript_localize(myScript.strTypeOpts) + "}, alignment:['fill','top'], preferredSize:[-1,20]},\
},\
main: Group { \
run: Button { text:'" + myScript_localize(myScript.strRun) + "', alignment:['right','center'], preferredSize:[-1,20] }, \
} \
}";

pal.grp = pal.add(res);


pal.onResizing = pal.onResize = function () {this.layout.resize();}
pal.grp.header.help.onClick = function () {alert(myScript.scriptTitle + "\n" + myScript_localize(myScript.strHelpText),myScript.scriptName);}
pal.grp.header.about.onClick = function () {alert(myScript.scriptTitle + "\n" + myScript_localize(myScript.strAboutText),myScript.scriptName);}
pal.grp.main.run.onClick = myScript_RunScript;

return pal;
}

}
var myScriptPal = myScript_buildUI(thisObj);

function myScript_RunScript()
{

var myComp = app.project.activeItem;
var music = myComp.layer("music");
var video= myComp.layer("video");
//var amplitude = myComp.layer("Audio Amplitude");
var myEffect = music.property("Effects").addProperty("High-Low Pass");

myEffect.property("Filter Options").setValue(1);
myEffect.property("Cutoff Frequency").setValue(50);

// then I want to do "convert audio to keyframes"
app.executeCommand(app.findMenuCommandId("Convert Audio to Keyframes"));

var myEffect = video.property("Effects").addProperty("Box Blur");
myEffect.property("Blur Radius").expression = 'thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")';

var myEffect = video.property("Effects").addProperty("Noise");
myEffect.property("Amount of Noise").expression = 'thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")';

}


if((myScriptPal != null) && (myScriptPal instanceof Window)){
myScriptPal.center();
myScriptPal.show();
}
} )(this);


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]