Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Script to trim end point of layer when opacity is at 0%.

  • Script to trim end point of layer when opacity is at 0%.

    Posted by Kyle Ussery on October 5, 2020 at 5:44 pm

    Hello all,

    I’d like to create a script that looks a selected comp (or selected layers), and trims the end point of each layer when the opacity is at 0%.

    The context is Power Point presentations. I have the slides on a time line, each with an expression that looks at a .csv file, turning the opacity to 0% when timeToCurrentFormat() reaches the specified time.

    The expression:

    f=footage(“TimeCode.csv”).dataValue([1,index-1]);

    s=timeToCurrentFormat();

    if (s<f)100; else 0;

    <font face=”inherit”>The expression works great, the only issue is the render time. Some of these are 100+ layers, and I feel they would render much more quickly if the end points were trimmed so the expression on each layer wasn’t running the whole time it renders. Of course I could do it </font>manually<font face=”inherit”>, but that too takes a fair amount of time.</font>

    <font face=”inherit”>Any ideas?</font>

    Thanks in advance,

    Kyle

    Kyle Ussery replied 5 years, 6 months ago 3 Members · 4 Replies
  • 4 Replies
  • Stephen Dixon

    October 6, 2020 at 2:19 am

    Your question is very broad; that would definitely be something that you could script. Either to create the comp from scratch given the CSV, or to trim the ends based on the opacity. https://docs.aenhancers.com is the place to go for extendscript documentation.

  • Filip Vandueren

    October 6, 2020 at 2:52 pm

    I’ve written a script for this some time ago:

    it checks if the first and/or last keyframe of opacity and/or scale == 0 and trims to those points.

    Here it is:

    https://we.tl/t-c4ff1fW2mC

    Choinks – date modified is 2008, I’m getting really old 😉

    Still works though!

  • Filip Vandueren

    October 6, 2020 at 2:53 pm

    Oops, but that does mean you’d have to create keyframes though.

  • Kyle Ussery

    October 10, 2020 at 11:55 pm

    Thanks Filip, I’ll check this out. I usually always gain some new knowledge from scripts, even if the scenario isn’t exactly right.

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