Forum Replies Created

Page 70 of 1081
  • Dan Ebberts

    November 1, 2022 at 4:07 pm in reply to: Audio Expression

    Assuming you put the checkboxes on the Scene precomp layers, this is how I’d do it:

    audioOn = -22;
    audioOff = -6;
    fadeFrames = 10;
    fadeTime = framesToTime(fadeFrames);
    v = audioOff;
    for (i = 1; i <= thisComp.numLayers; i++){
    myLayer = thisComp.layer(i);
    if (myLayer.index == index) continue;
    if (myLayer.name.indexOf("Scene") == 0 && time >= myLayer.inPoint && time <= myLayer.outPoint){
    if (myLayer.effect("On")("Checkbox") == 1){
    if (time < (myLayer.inPoint + myLayer.outPoint)/2){
    v = linear(time,myLayer.inPoint,myLayer.inPoint + fadeTime,audioOff,audioOn);
    }else{
    v = linear(time,myLayer.outPoint - fadeTime,myLayer.outPoint,audioOn,audioOff);
    }
    }
    break;
    }
    }
    [v,v]
  • Dan Ebberts

    October 31, 2022 at 7:43 pm in reply to: Audio Expression

    That seems pretty complex. Can you describe the set up a little? Do your scenes ever overlap? Does the checkbox need to be inside the scene comp, or could it be on the precomp layer so the expression doesn’t need to dig into the precomp to get it? From looking at the code, it looks like the precomp layers don’t have the same names as the precomps themselves, is that correct?

  • Dan Ebberts

    October 31, 2022 at 7:39 pm in reply to: Expression to move clip on timeline

    For example, this simple time remapping expression will hold a clip at frame 0 until the clip’s first marker is reached. The clip then plays from the marker onward.

    t = 0;
    if (marker.numKeys > 0){
    t = time - marker.key(1).time;
    }
  • Dan Ebberts

    October 31, 2022 at 7:26 pm in reply to: Expression to move clip on timeline

    Expressions can’t move a clip, but if you turn on time remapping for the clip, a time remapping expression can determine when it plays.

  • Dan Ebberts

    October 29, 2022 at 1:23 am in reply to: Wiggle Scale X only??

    <div>>Maybe an array or something?</div>

    Yes, try it this way:

    [wiggle(10,5)[0], value[1]]
  • Dan Ebberts

    October 26, 2022 at 11:15 pm in reply to: Same expression works in one comp but not in the others
    s -= l.startTime;

    is equivalent to this:

    s = s - l.startTime;
  • Dan Ebberts

    October 26, 2022 at 4:03 pm in reply to: Same expression works in one comp but not in the others

    It just subtracts the layer’s start time from the marker time, to compensate for the layer not starting at time = 0.

  • Dan Ebberts

    October 26, 2022 at 5:07 am in reply to: sourceRectAtTime does not work with text animators

    If you create a type-on effect with a source text expression like this:

    rate = 20;
    value.substr(0,time*rate)

    then

    yourTextLayer.sourceRectAtTime(time,false)

    will give you accurate results.

  • Dan Ebberts

    October 25, 2022 at 7:56 pm in reply to: Scripting – convert expression to keyframes

    Once you’ve capture the selected layers into myLayers, I think you need to deselect them all, so that only one property at a time is selected:

    function addKeys(){
    var myComp = app.project.activeItem;
    var myLayers = myComp.selectedLayers;
    if (myLayers.length > 0){
    var myLayer = myLayers[0];
    for (var i = 0; i < myLayers.length; i++){
    myLayers[i].selected = false;
    }
    for (var i = 0; i < myLayers.length; i++){
    try{
    var myProp = myLayers[i].effect("Opacity Controller")("Opacity Offset");
    myProp.expressionEnabled = true;
    myProp.selected = true;
    app.executeCommand(app.findMenuCommandId("Convert Expression to Keyframes"));
    }catch(err){ }
    myLayers[i].selected = false;
    }
    }
    }
  • Dan Ebberts

    October 25, 2022 at 5:43 pm in reply to: Same expression works in one comp but not in the others

    Just a hunch that the ones that don’t work also don’t start at time=0 in the “footage strip” comp.

    If that’s the case, try this:

    c=comp("footage strip");
    l= c.layer(thisComp.name);
    s=l.marker.key(1).time;
    d=comp("footage strip").layer("xp").effect("fd")("Slider");
    s -= l.startTime;
    ease(time,s,(s+d),0,100);
Page 70 of 1081

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