Forum Replies Created

Page 139 of 1081
  • Dan Ebberts

    June 15, 2020 at 9:59 pm in reply to: Text expression selector

    Try this:


    myArray = [3,10,17,20];
    included = false;
    for (i = 0; i < myArray.length; i += 2){
    if (i < myArray.length-1){
    if (textIndex >= myArray[i] && textIndex <= myArray[i+1]){
    included = true;
    break;
    }
    }
    }
    included ? 100 : 0

    Dan

  • Dan Ebberts

    June 15, 2020 at 9:51 pm in reply to: Get Position of Stroke Offset

    See if this works:

    L = thisComp.layer(“Shape Layer 1”);
    p = L.content(“Shape 1”).content(“Path 1”).path;
    pct = L.content(“Shape 1”).content(“Trim Paths 1”).end/100;
    offset = (L.content(“Shape 1”).content(“Trim Paths 1”).offset%360)/360;
    L.toComp(p.pointOnPath(pct + offset))

    Dan

  • Dan Ebberts

    June 15, 2020 at 4:46 pm in reply to: Get Position of Stroke Offset

    This is a simple example that will track the End point of the Trim Paths:

    L = thisComp.layer(“Shape Layer 1”);
    p = L.content(“Shape 1”).content(“Path 1”).path;
    pct = L.content(“Shape 1”).content(“Trim Paths 1”).end/100;
    L.toComp(p.pointOnPath(pct))

    Dan

  • Dan Ebberts

    June 14, 2020 at 6:07 pm in reply to: link value effect above on same layer

    You could try this:


    p = thisProperty;
    idx = p.propertyIndex;
    effectIdx = p.propertyGroup(1).propertyIndex;
    if (effectIdx != 1)
    p.propertyGroup(2)(effectIdx-1)(idx).value
    else
    value

    If the effect above could possibly be a different effect, you may want to add some defensive code to avoid an expression error (or unexpected result) in that case.

    Dan

  • Assuming all the layers are contiguous in the layer stack and the parent is on top, something like this might work:

    (index – parent.index)*2

    Dan

  • There are a lot of ways to do it–this is one:


    names = ["Line01","Line02","Line03","Line04","Line05","Line06"];
    w = 0;
    for (i = 0; i < names.length; i++){
    w = Math.max(w,thisComp.layer(names[i]).sourceRectAtTime(time,false).width);
    }
    w

    Dan

  • Assuming you leave Units set to Percentage, something like this should work:

    n = text.sourceText.value.length;
    t = time – inPoint;
    (t/framesToTime(n))*100

    Dan

  • Dan Ebberts

    June 8, 2020 at 2:25 pm in reply to: Move CTI by script?

    This seems to work:

    var myComp = app.project.activeItem;
    myComp.time += 5*myComp.frameDuration;

    Dan

  • Dan Ebberts

    June 8, 2020 at 12:57 am in reply to: Distribute multiple layers between two End layers?

    I think this will distribute a property between two layers named “Start Layer” and “End Layer” (change the first two lines if your bookend layers have different names):


    startLayerName = "Start Layer";
    endLayerName = "End Layer";
    sStr = 'thisComp.layer("' + startLayerName + '")';
    eStr = 'thisComp.layer("' + endLayerName + '")';
    sIdx = eval(sStr + '.index');
    eIdx = eval(eStr + '.index');
    p = thisProperty;
    str = ".value";
    while(!(p instanceof Layer)){
    str = '("' + p.name + '")' + str;
    p = p.propertyGroup(1);
    }
    sVal = eval(sStr + str);
    eVal = eval(eStr + str);
    linear(index,sIdx,eIdx,sVal,eVal)

    It assumes that the layers are contiguous in the layer stack, with “Start Layer” at the top and “End Layer” at the bottom.

    Dan

  • Dan Ebberts

    June 6, 2020 at 3:52 pm in reply to: Check for an invalid Object

    I think isValid() does what you want:


    var c = app.project.activeItem;
    var a = c.layer(1); // "[object AVLayer]"
    a.remove();
    if (isValid(a)){
    alert(a.name);
    }else{
    // do something else
    }

    Dan

Page 139 of 1081

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