Forum Replies Created

Page 26 of 1081
  • I think you’ll need to ask the developer for help. I don’t there’s any way for anyone else to know what’s going on at line 47 in the script.

  • Dan Ebberts

    April 17, 2024 at 2:47 pm in reply to: Use Keyframe as trigger

    Yes, core JavaScript knowledge is always helpful, for both expressions and scripting. I always keep a copy of David Flanagan’s “JavaScript, the Definitive Guide” handy.

  • Dan Ebberts

    April 17, 2024 at 4:25 am in reply to: Use Keyframe as trigger

    I’m not sure this is exactly what you’re after, but it should get you close. This defines a bunch of colors in an array (you could get them from color controls instead) and will transition between colors at layer markers:

    //          red       yellow    green      cyan      blue    magenta
    colors = [[1,0,0,1],[1,1,0,1],[0,1,0,1],[0,1,1,1],[0,0,1,1],[1,0,1,1]];
    fadeDur = .5;
    m = marker;
    n = 0;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    }
    if (n == 0 || m.numKeys == 1){
    colors[0];
    }else if (n >= colors.length || n >= m.numKeys){
    colors[colors.length-1];
    }else{
    t1 = m.key(n).time;
    t2 = t1 + fadeDur;
    v1 = colors[n-1];
    v2 = colors[n];
    linear(time,t1,t2,v1,v2);
    }
  • Ah, OK. You might have to move the calculation of EndPos outside of the time test. So it would be structured more like this:

    //Define variables//
    a = content("Rectangle Path 1").size[0];
    b = content("Rectangle Path 1").size[1];
    IAD = thisComp.layer("CTRL").effect("Intro Animation Direction")("Menu");
    IEP = thisComp.layer("CTRL").effect("Intro End Position - Horizontal")("Menu");
    //Convert from second to frames - Animators don't work in seconds...//
    Intro_Anim_Duration = thisComp.layer("CTRL").effect("Intro Anim Duration(frames)")("Slider")
    anim_duration_seconds = thisComp.frameDuration * Intro_Anim_Duration;
    outroStart = thisComp.layer("CTRL").effect("Outro Begin (seconds)")("Slider");
    if (IEP == 1){
    EndPos = thisComp.width *0.05+a/2;
    }else if(IEP == 2){
    EndPos = thisComp.width/2;
    }else{
    EndPos = thisComp.width *0.95-a/2;
    }
    //Custom Easing Function Start//
    function easeOutExpo (t, b, c, d) {
    var OUT_EXPO_CORRECTION = 1.000976;
    return (t==d) ? b+c : c * OUT_EXPO_CORRECTION * (-Math.pow(2, -10 * t/(d)) + 1) + b;
    };
    var startDur = 0;
    var endDur = anim_duration_seconds;
    t = time - startDur;
    d = endDur - startDur;
    //Custom Easing Function End//
    if (time < outroStart){
    if (IAD == 1){
    easeOutExpo(t,-a/2, EndPos - -a/2, d);
    }else if(IAD == 2) {
    easeOutExpo(t, thisComp.width+a/2, EndPos-thisComp.width-a/2, d)
    }else{
    EndPos
    }
    }else{
    // outro code goes here
    }
  • Dan Ebberts

    April 12, 2024 at 2:36 pm in reply to: Comp() not working

    Can you post a screenshot of the timeline that shows the layer with the expression and the comp layer? Or is that not the setup?

  • OK, as a simple example, say you have a slider that defines the outro begin time in seconds, you could structure the whole thing like this:

    outroStart = thisComp.layer("CTRL").effect("Outro Begin (seconds)")("Slider");
    if (time < outroStart){
    // intro code goes here
    }else{
    // outro code goes here
    }
  • That is certainly possible. The details depend on how you’re doing the in and out animations (expressions? keyframes?). What does the slider do, exactly–does it set the time to start the out animation? More details would be helpful.

  • Dan Ebberts

    April 11, 2024 at 7:17 pm in reply to: Comp() not working

    See if this works:

    C = comp("Shot 04 - Essentials");
    ctrl = C.layer("Light Control").transform.opacity;
    L = thisComp.layer("Shot 04 - Essentials");
    ctrl.valueAtTime(time-L.startTime)
  • Dan Ebberts

    April 10, 2024 at 6:51 am in reply to: Reversed order when using script to copy layers

    This should work:

    function copyLayersFromCompToComp(sourceComp, destinationComp) {
    var allSourceLayers = sourceComp.layers
    for (var sourceLayerIndex = sourceComp.numLayers; sourceLayerIndex > 0; sourceLayerIndex--) {
    var sourceLayer = sourceComp.layer(sourceLayerIndex);
    sourceLayer.copyToComp(destinationComp)
    }
    }
  • Dan Ebberts

    April 10, 2024 at 12:12 am in reply to: Pseudo Effects Default Expressions

    I think you’d have to save the your effect, with the expression applied, as a preset.

Page 26 of 1081

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