Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Trigger composition start on Controller position – Code tidy-up

  • Trigger composition start on Controller position – Code tidy-up

    Posted by Andy Hill on April 9, 2013 at 9:24 am

    Hi everyone,

    I’ve currently got a working composition and it has the functionality I would like however it is rendering exceedingly slow and I am struggling to find a better way of coding the expressions so it doesn’t run so slowly.

    I have time remap key frames on the playing compositions and have placed the expression on that, I also have a null that acts as the controller so once that null passes a certain x point it triggers the composition to play. The play composition is a simple solid that scales and has a bounce on it, this play comp is then duplicated numerous times and spread out along the x axis to form a ruler.

    The entire composition acts as ruler marks that stretch to measure certain things so I’ve created it this way to enable the easy editing of the ruler length so needs to retain the same functionality and not trigger at the start. The entire project will be used multiple times and by various people so I need it to be easy to edit.

    I’ve looked into ‘index’ but don’t want to use time as a variable as the entire piece will be different timings each time it is used. There might be a way of using index but I’m reaching the limits of my knowledge.

    I hope I’ve explained it okay and any thoughts on how to speed it up would be greatly appreciated.

    “< (less than) symbol isn’t appearing in the expression below but it is where (& l t 😉 is”

    Here is the project files to have a look at:

    5803_dimensionsruler.aep.zip

    Cheers,
    Andy

    range = 20;
    point2 = thisComp.layer("[Control]").transform.position;
    point1 = transform.position;
    above = false;

    for (f = timeToFrames(inPoint);
    f &lt;= timeToFrames(); f++){
    t = framesToTime(f);
    distance = length(point1.valueAtTime(t),point2.valueAtTime(t));
    if (distance &lt;= range ){ above = true; break;
    }
    } if (above) time - t else 0;

    Andy Hill replied 13 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Sean Mcclintock

    April 25, 2013 at 8:58 pm

    Figured it out. Not sure exactly why but when I changed the R>1 to R<1 it started returning the right value.

  • Andy Hill

    April 26, 2013 at 8:53 am

    Hey,

    I’m not too sure what you mean about R>1 or R<1.

    Cheers,
    Andy

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