Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions proximity detection expression with hold

  • proximity detection expression with hold

    Posted by Peter Van der zee on May 10, 2011 at 8:00 am

    Hi, I’m having a small problem here I haven’t found a way to solve yet.
    I’m having a screen full of characters that are vectorial layers each of them,
    I want them to fly away in all directions when a (invisible) layer (solid) is passing by.
    I came up with a “particular” that generates the same letters flying away
    and I got sofar that the original letter swiches off when the solid that drives “particular’s generator” passes by, in this way:

    out = [100]
    delta = (width + thisComp.layer(“White Solid 2”).width)/2;
    if (length(position, thisComp.layer(“White Solid 2”).position) <= delta)
    {out = [0]}

    Now what is missing is that the layer stays off after the solid has passed, like freezing or loop out
    or something like that. I’m not expressionist enough to figure it out on my own…

    out = [100]
    delta = (width + thisComp.layer("White Solid 2").width)/2;
    if (length(position, thisComp.layer("White Solid 2").position) &lt;= delta)
    {out = [0]}

    http://www.zeemotion.com

    Peter Van der zee replied 15 years ago 2 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    May 10, 2011 at 1:29 pm

    This should work:


    f = timeToFrames();
    gotIt = false;
    while (f >= timeToFrames(inPoint)){
    t = framesToTime(f);
    delta = (width + thisComp.layer("White Solid 2").width)/2;
    p1 = position.valueAtTime(t);
    p2 = thisComp.layer("White Solid 2").position.valueAtTime(t);
    if (length(p1,p2) <= delta){
    gotIt = true;
    break;
    }
    f--;
    }
    gotIt ? 0 : 100

    Dan

  • Peter Van der zee

    May 10, 2011 at 1:59 pm

    Yeah, it does!
    Now only got to get my head around it, I like to understand why/how it works
    but I got some intuition about it. Nice!
    Thank you very much Dan (you sure are a walking expressions diccionary!)

    http://www.zeemotion.com

  • Peter Van der zee

    May 10, 2011 at 2:18 pm

    Great, gotIt!
    One more (stupid) question,
    Is there a way to copy an expression to lots of layers at the time?
    (in this particular project, I’m looking at more then 1000 layers and copy the expression one by one is a bit time-consuming…

    Thanks again, Peter

    Forget I said that, it’s as simple as copying the opacity to all the layers instead of trying to copy the expression… errr

    http://www.zeemotion.com

  • Dan Ebberts

    May 10, 2011 at 2:32 pm

    Or,

    Select the property with the expression, Edit>Copy Expression Only, select all the other layers, Edit>Paste

    Dan

  • Peter Van der zee

    May 10, 2011 at 4:37 pm

    Uncountable years on AE and still learning new things on almost every project,
    Thanks to people like you.

    http://www.zeemotion.com

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