Forum Replies Created

Page 22 of 65
  • cW = thisComp.width;
    cH = thisComp.height;
    antiClockwize = [[-cW/2,-cH/2], [-cW/2,cH/2],[cW/2,cH/2],[cW/2,-cH/2]];
    clockwize = [[cW/2,cH/2],[-cW/2,cH/2],[-cW/2,-cH/2], [cW/2,-cH/2]];
    corners = (thisComp.layer("Null 1").effect("Clockwize")("Checkbox").value == 1) ? clockwize : antiClockwize;
    startCorner = thisComp.layer("Null 1").effect("Start_Point")("Slider").value%4;
    p1 = (startCorner == 0) ? [] : corners.splice(0,startCorner);
    corners = corners.concat(p1);
    createPath(corners)

    function arrIncludes(arr, element) {

    for (var i = 0; i < arr.length; i++) {

    if (element == arr[i]) return true

    }

    return false;

    }

    L = thisComp.width;

    l = thisComp.height;

    percentL = 50 * L / (L + l);

    percentl = 50 * l / (L + l);

    beginPoint = thisComp.layer("Null 1").effect("Start_Point")("Slider").value%4;

    stopPoint = thisComp.layer("Null 1").effect("End_Point")("Slider") % 4;

    shortPoints = (thisComp.layer("Null 1").effect("Clockwize")("Checkbox") == 1) ? [1,3] : [0, 2];

    firstLInstances = Math.ceil(stopPoint / 2);

    if (arrIncludes(shortPoints, beginPoint)) {

    theEnd = percentl * firstLInstances + percentL * (stopPoint - firstLInstances);

    } else {

    theEnd = percentL * firstLInstances + percentl * (stopPoint - firstLInstances);

    }

    theEnd = theEnd == 0 ? 100 : theEnd;

    linear(time, 0, thisComp.duration-thisComp.frameDuration, 0, theEnd)

  • “1 – cOrder=[1,2,3,0]” this does nothing. It works anticlockwise without this.

    The rectangle does not complete because the last frame in the composition is invisible. You should subtract a frame from linear in order to fix this, not add to the percentage.

    linear(time, 0, thisComp.duration-thisComp.frameDuration, 0, theEnd)

    And you have to change those numbers for corners because you described it wrongfully in your post. You said in this order: bottom right, bottom left, top right, top left(it was bottom left, bottom right etc.). It actually was more complicated to me to do it the way you described it.

    All in all, this should work now:

    cW = thisComp.width;

    cH = thisComp.height;

    corners = [[-cW/2,-cH/2], [-cW/2,cH/2],[cW/2,cH/2],[cW/2,-cH/2]];

    startCorner = thisComp.layer("Null 1").effect("Start_Point")("Slider").value%4;

    p1 = (startCorner == 0) ? [] : corners.splice(0,startCorner);

    corners = corners.concat(p1);

    createPath(corners)

    function arrIncludes(arr, element) {

    for (var i = 0; i < arr.length; i++) {

    if (element == arr[i]) return true

    }

    return false;

    }

    L = thisComp.width;

    l = thisComp.height;

    percentL = 50 * L / (L + l);

    percentl = 50 * l / (L + l);

    beginPoint = thisComp.layer("Null 1").effect("Start_Point")("Slider").value%4;

    stopPoint = thisComp.layer("Null 1").effect("End_Point")("Slider") % 4;

    shortPoints = [0, 2];

    firstLInstances = Math.ceil(stopPoint / 2);

    if (arrIncludes(shortPoints, beginPoint)) {

    theEnd = percentl * firstLInstances + percentL * (stopPoint - firstLInstances);

    } else {

    theEnd = percentL * firstLInstances + percentl * (stopPoint - firstLInstances);

    }

    theEnd = theEnd == 0 ? 100 : theEnd;

    linear(time, 0, thisComp.duration-thisComp.frameDuration, 0, theEnd)

  • And this to the End property of your trim paths. You have to also add a slider control named Stop Point in which you write at which point you want it to stop. In the shortPoints = [1, 4]; I wrote the point which start a height line.

    function arrIncludes(arr, element) {

    for (var i = 0; i < arr.length; i++) {

    if (element == arr[i]) return true

    }

    return false;

    }

    L = thisComp.width;

    l = thisComp.height;

    percentL = 50 * L / (L + l);

    percentl = 50 * l / (L + l);

    beginPoint = effect("Slider Control")("Slider").value;

    stopPoint = effect("Stop Point")("Slider") % 4;

    shortPoints = [1, 4];

    firstLInstances = Math.ceil(stopPoint / 2);

    if (arrIncludes(shortPoints, beginPoint)) {

    theEnd = percentl * firstLInstances + percentL * (stopPoint - firstLInstances);

    } else {

    theEnd = percentL * firstLInstances + percentl * (stopPoint - firstLInstances);

    }

    theEnd = theEnd == 0 ? 100 : theEnd;

    linear(time, 0, thisComp.duration, 0, theEnd)

  • Ok, try this for your path

    cW = thisComp.width;
    cH = thisComp.height;
    corners = [[-cW/2,-cH/2], [-cW/2,cH/2],[cW/2,cH/2],[cW/2,-cH/2]];
    startCorner = effect("Slider Control")("Slider").value%4;
    cOrder = [2,1,3,0];
    p1 = (startCorner == 0) ? [] : corners.splice(0,cOrder[startCorner-1]);
    corners = corners.concat(p1);
    createPath(corners)

  • I added a slider control to the layer.

    This works for me with a slider with values 1-4 but other order than you said.

    cW = thisComp.width;
    cH = thisComp.height;
    corners = [[-cW/2,-cH/2], [-cW/2,cH/2],[cW/2,cH/2],[cW/2,-cH/2]];
    startCorner = effect("Slider Control")("Slider");
    p1 = corners.splice(0,startCorner-1);
    corners = corners.concat(p1);
    createPath(corners)

    This is to make the order as you wanted it

    cW = thisComp.width;
    cH = thisComp.height;
    corners = [[-cW/2,-cH/2], [-cW/2,cH/2],[cW/2,cH/2],[cW/2,-cH/2]];
    startCorner = effect("Slider Control")("Slider");
    cOrder = [2,1,3,0];
    p1 = corners.splice(0,cOrder[startCorner-1]);
    corners = corners.concat(p1);
    createPath(corners)

  • I just watched the way you create your rectangle. That works too in this case but double clicking on the rectangle tool would save you some seconds 😀

  • Hey. Add this to your path property. The path should be at position [0,0] with anchorPoint [0,0] and the layer in the middle of the composition(double clicking on the rectangle tool creates just this)

    cW = thisComp.width;
    cH = thisComp.height;
    corners = [[-cW/2,-cH/2], [-cW/2,cH/2],[cW/2,cH/2],[cW/2,-cH/2]];
    startCorner = 2;
    p1 = corners.splice(0,startCorner-1);
    corners = corners.concat(p1);
    createPath(corners)

    startCorner should be linked to your effect on the null(the one you want to control the start point with, obviously :D)

  • Andrei Popa

    September 24, 2020 at 6:05 am in reply to: Looping audio

    Right-click the layer, Time>Enable Time Remapping.

    Now alt-click the stopwatch of the Time Remap property to be able to write expressions to it. Write

    loopOut()

    Now make your layer the length of your composition.

  • Andrei Popa

    September 24, 2020 at 6:00 am in reply to: Changing Values in a Precomp

    This was my setup. If you change anything(comp name, precomp name, effect name) you must also change it in the expression.

    Main composition name = Main Comp

    Pre-comp name(as layer, this means as seen in timeline, not project panel) = Shot 1

    Add a 3D point effect to pre-comp.

    I named it CTRL.

    Now go inside the precomp and on the layer that you want the scale to be modified write this expression:

    myComp = comp("Main Comp");
    myLayer = myComp.layer("Shot 1");
    myEffect = myLayer.effect("CTRL")("ADBE Point3D Control-0001");
    myEffect.valueAtTime(sourceTime(time)+myLayer.inPoint);

  • Andrei Popa

    September 22, 2020 at 7:57 am in reply to: Expressions to sort numbers in descending order.

    I think he needs and extra “\r” for the empty lines

    sorted.join(“\r\r”)

Page 22 of 65

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