Forum Replies Created

  • Hi John, I now had time to run your expression and sadly nothing happens.

    I tried to pinpoint the issue and I am pretty sure it is the “return -1” for the “function findLastEntrance(t). Shouldn’t there be some kind of variable instead of -1?

    I replaced the -1 with the number of seconds when there is the actual crossing happening, and the rest of the expression works fine.

  • Hi John, I certainly appreciate your help and what you are describing is exactly what I am looking for. I will give this a test run first thing tomorrow morning. Hopefully I can learn something as well and put it to good use for future problems ;-).

    Cheers, Klaus

  • As I have stated above, I have a setup of multiple shape layers and one null on a comp. The shapes are static and the null is moving around. The shapes have a glow effect attached to it.

    My usual approach is a linear expression: the closer the null gets to a shape, starting at a certain range, the effect opacity rises from 0 to 100 and down again when the null moves away.

    However, the effect I want to achieve is a little different. As soon as the null approaches, the shape should start animating from 0 to 100 and back. But this animation should play out even if the null is no longer close to it. The proximity of the null is basically the trigger for the animation to start.

  • Thank you for the solution. It works but as I found out, as you said, I cannot really work with it.

    Also, even my initial expression with a about 20 shapes and one minute comp duration brought the comp to a still stand. I have to think of a different approach.

  • Klaus Hertweck

    May 21, 2025 at 4:20 pm in reply to: Check for shortest distance

    That helped me a lot!
    Thank you very much.

  • Klaus Hertweck

    May 21, 2025 at 12:36 pm in reply to: Check for shortest distance

    I figured out the correct expression myself.

    First, I set up a null with an expression controls Slider Control “check distance” (just to do some of the calculations).

    There, I calculated the distance:

    var posA = thisComp.layer(“Shape A”).transform.position;
    var posB = thisComp.layer(“Shape B”).transform.position;
    var distance = length(posA, posB);
    distance

    On another slider, I set up the frame expression:

    var distance = effect(“check distance”)(“Slider”);
    var compLength = thisComp.duration / thisComp.frameDuration;
    for (i = 0; i <= compLength; i++) {
    if (distance.valueAtTime(framesToTime(i+1)) >= distance.valueAtTime(framesToTime(i))) break
    }
    i


    I would have liked to put all the expressions onto a single slider. However, when I insert length(posA, posB).valueAtTime(framesToTime(i) into the expression, I get an error: This is not a function.

    Is there a way to get around this error?

  • Hi John,

    thank you very much for visualising your solution!

  • Hi Dan,

    thanks a lot! This works perfectly!

  • Thank you Dan!

    It worked just perfectly!

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