Hello Guys,So first sorry if I post in the wrong categorie, I try to do my best lolSo I'm new in the scripts and javascript and I try to do it simple.I'm a VJ and want to create a script where I enter a "BPM" and a "beat" lengh and it generate me a comp with the right lengh and ass a layer with a marker ofr each beat.I was able to create that script but As I try to make it look a bit better with a buildUI for AE I was not able to make it work right. If someone can help me or give me some tips. I think I'm not right withe "addComp" expression in the buildUI function.
I don't copy everythin because it's long but you will understaind the main Idea. My question is how to have the entry in my buildUI instead of the "prompt"
Here is my first code who does the job :
//Set Var Elements
var name = prompt("Composition name");
var BPM =prompt("Your BPM");
if (isNaN(BPM)) {
alert("You must give the comp a value");
}
var Beats = prompt("How Many Beat");
if (isNaN(Beats)) {
alert("You must give the comp a value");
}
var frameRate = prompt("Your fps");
if (isNaN(frameRate)) {
alert("You must give the comp a value");
}
var duration = ( 60 / BPM * Beats ); //Auto Generated
var beat = (60 / BPM);
//Creation Part
app.project.items.addComp(name, 1920, 1080, 1, duration, frameRate); // Create Comp with Custom Lengh
app.project.item(01).layers.addSolid([0,0,0], "BG", 1920, 1080, 1, duration); // Create BG Solid
var firstLayer = app.project.item(1).layer(1);
firstLayer.label = 16;
app.project.item(01).layers.addSolid([0,0,0], "FX", 1920, 1080, 1, duration); // Create FX Solid
app.project.item(01).layers.addNull(duration); // Create Null Object
var firstLayer = app.project.item(1).layer(1); // Rename Null Object
firstLayer.enabled = false;
firstLayer.name = "Beats";
firstLayer.label = 0;
// Place a marker on the 64 first beat
var myMarker = new MarkerValue("0");
firstLayer.property("Marker").setValueAtTime(beat*0, myMarker);
// Key every Beat on opacity
myProperty = firstLayer.opacity;
myProperty.setValueAtTime(beat*0, 0);