Forum Replies Created

Page 1 of 2
  • Awesome, thanks Dan!

  • Ole Peters

    December 5, 2015 at 8:50 pm in reply to: Faster / Less calculation heavy expression needed

    Works!
    Thank you so much, Dan

  • Ole Peters

    December 5, 2015 at 8:07 pm in reply to: Faster / Less calculation heavy expression needed

    How do I implement that into the script so I get the alarm?

    The whole thing looks like that right now:

    function AtA(thisObj)
    {

    //==================
    var version = '1';
    //==================

    var palette = (thisObj instanceof Panel) ? thisObj : new Window('palette','AtA',undefined, {resizeable:true});
    palette.orientation = 'stack';
    palette.alignChildren = ['fill','fill'];

    function addHGroup(container){
    var groupe = palette.add('group');
    groupe.alignChildren = ['fill','fill'];
    groupe.orientation = 'row';
    groupe.spacing = 10;
    groupe.margins = 3;
    return groupe;
    }
    var bottomGroup = addHGroup('mainGroup');
    bottomGroup.alignment = ['fill','bottom'];

    {
    var trimCompURL = bottomGroup.add ('statictext',undefined,'Custom');
    trimCompURL.alignment = ['right','bottom'];
    }

    var guiP = palette.add('group');
    guiP.orientation = 'column';
    guiP.alignChildren = ['fill', 'fill'];
    var tcB = guiP.add('tabbedpanel', undefined, '');
    var tabContent1 = tcB.add('tab', undefined, 'Convert');
    var tabB = tabContent1.add('button', undefined, 'Convert dat shit!');
    tabB.size = [100,50];
    tabB.alignment = ['center', 'center'];
    var tabContent2 = tcB.add('tab', undefined, 'Version & Credits');
    tabContent2.add('statictext', undefined, ' -- ' + 'AtA v' + (version) + ' -- ' + '\n\n' , {multiline:true});

    tabB.onClick = function () {
    function main(){
    var myComp = app.project.activeItem;

    var newSliderControl = myComp.layer("Audio Amplitude").property("Effects").addProperty("ADBE Slider Control");
    newSliderControl.name = "Accum";
    var mySlider = newSliderControl.property("Slider");
    var spdSlider = myComp.layer("Audio Amplitude").property("Effects").property("Both Channels").property("Slider");

    var accum = 0;
    mySlider.setValueAtTime(spdSlider.keyTime(1),accum);
    for (var i = 2; i <= spdSlider.numKeys; i++){
    accum += (spdSlider.keyValue(i) + spdSlider.keyValue(i-1))/2;
    mySlider.setValueAtTime(i*myComp.frameDuration,accum);

    }
    }
    var selLayer = app.project.activeItem;
    if (selLayer.selectedLayers.length == 0){
    alert ("No layer selected.");
    return;

    }

    main();
    }

    guiP.hide();
    function loadAtA() {
    guiP.show();
    }
    loadAtA();

    palette.layout.layout(true);
    palette.layout.resize();
    palette.onResizing = palette.onResize = function () { this.layout.resize(); }
    if (!(thisObj instanceof Panel)) palette.show();

    return palette;

    }

    AtA(this);

    If I try to put it in there it still adds the Accum Slider but you can still add another one and another one, I have to get into scripts more..

    Ole

  • Ole Peters

    December 5, 2015 at 2:01 pm in reply to: Faster / Less calculation heavy expression needed

    Works perfectly! Thank you, Dan!

    One last question, how do I check if the Accum slider is already on a layer?
    I’ve thought about something like this:

    tabB.onClick = function () {
    function main(){
    var myComp = app.project.activeItem;

    var newSliderControl = myComp.layer("Audio Amplitude").property("Effects").addProperty("ADBE Slider Control");
    newSliderControl.name = "Accum";
    var mySlider = newSliderControl.property("Slider");
    var spdSlider = myComp.layer("Audio Amplitude").property("Effects").property("Both Channels").property("Slider");

    var accum = 0;
    mySlider.setValueAtTime(spdSlider.keyTime(1),accum);
    for (var i = 2; i <= spdSlider.numKeys; i++){
    accum += (spdSlider.keyValue(i) + spdSlider.keyValue(i-1))/2;
    mySlider.setValueAtTime(i*myComp.frameDuration,accum);

    }
    }
    var selLayer = app.project.activeItem;
    if (selLayer.selectedLayers.length == 0){
    alert ("No layer selected.");
    return;

    }
    var dCheck = selLayer.property("Effects").property("Accum").property("Slider");
    if (dCheck == selLayer.property("Effects")){
    alert("Accum is already applied.");
    }

    main();
    }

    Everything works until I add the part with the dCheck to tell me that Accum is already applied.
    Any ideas?

    Ole

  • Ole Peters

    December 4, 2015 at 1:34 pm in reply to: Faster / Less calculation heavy expression needed

    So, theres absolutely no other way of adding up values with an expression?
    Hm.

    My After Effects crashes when I try to convert the expression to keyframes and I don’t really want to use soundkeys because I would have to change the whole file.

  • Awesome, works perfectly!
    Thank you soo much Dan!

  • Since no one replied yet and I’m still hoping for at least Dan to reply I thought I’d rewrite the question. I really need to get that script to work, so please..

    I have a Project file with multiple compositions, 2 of those named “Music” and “Main”.
    I’m in the Music composition and the script is supposed to be executed inside of the Music composition while having the song layer selected. Now I want the script to take the length of the song layer and trim the Main composition to the length of the song. Also, onClick doesn’t seem to work.
    I have a basic GUI with a button and the onClick line would be for example this:
    tabContainer1.onClick = function () {alert("Hello World")} I don’t get anything though, when pressing the button.

    Again, I really need to get this to work and would really really appreciate if someone could help me out with this..

  • Ole Peters

    October 10, 2015 at 6:23 pm in reply to: Smooth out a Slider

    Oh!
    I did, but I used it wrong.
    Thank you very much Dan!

    Ole

  • Ole Peters

    August 8, 2015 at 11:54 pm in reply to: Camera Z Position move faster on a beat

    Works like a charm! You are awesome Dan!
    I kind if feel like a douche now, I forgot to say that a little treshold in the expression would be good. Is it possible to add it in the expression?
    I’m really sorry, I forgot it completely.

    Ole

  • Ole Peters

    August 8, 2015 at 10:30 pm in reply to: Camera Z Position move faster on a beat

    The Expression I use is
    temp = transform.position[0];
    temp1 = transform.position[1];
    temp2 = transform.position[2]+time*20;

    [temp , temp1 , temp2]

    So the Camera is moving forward on the Z axis.
    I added your expression like this:
    temp = transform.position[0];
    temp1 = transform.position[1];
    temp2 = transform.position[2]+time*20+YourExpression;

    [temp , temp1 , temp2]
    Assuming that it’ll accelerate the Camera on a beat of the Audio Amplitude.

    Ole

Page 1 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy