Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Script for making the length of a layer fit the entire duration

  • Script for making the length of a layer fit the entire duration

    Posted by Scott Green on February 6, 2019 at 11:43 am

    I’ve done some searching but have found no results that would help me to make a layer (i.e. a solid background) fit the entire duration of a comp, so if I wanted to change the duration of the comp the script would adjust the layer to fit the comp. I imagine it might be quite a simple one for someone, any ideas? Thanks.

    Scott Green replied 7 years, 3 months ago 2 Members · 4 Replies
  • 4 Replies
  • Andrei Popa

    February 6, 2019 at 12:00 pm

    Are you sure you are searching for a script? Because a script would need you to press a button or some similar action to trigger the modification of the length of the solid. However, if a script is what you are searching for, this could help


    myLayer = app.project.activeItem.selectedLayers[0];//Make sure your layer is selected
    myLayer.outPoint = (app.project.activeItem instanceof CompItem) ? app.project.activeItem.duration : myLayer.outPoint;

    Andrei
    My Envato portfolio.

  • Scott Green

    February 6, 2019 at 12:04 pm

    I mean an expression, where would I put that script?
    I thought maybe to the Time Remapping control but a solid doesn’t have one, pre-composing it didn’t work either?

  • Andrei Popa

    February 6, 2019 at 12:09 pm

    Maybe you could make it very long in the first place. Think what max duration of your comp might be, and make the solid that duration. To do that without script, just click the time stamp in the left side of the timeline area. And there write the max duration you think it could have(in hours:min:seconds:frames. Ex: 1200 for 12 seconds,11200 fo one minute 12 seconds). Now, with your layer selected, hit ] on your keyboard. Now your solid is this length. If you make your comp bigger, the solid is already bigger.

    Andrei
    My Envato portfolio.

  • Scott Green

    February 6, 2019 at 12:14 pm

    OK that’s fine, I’ll just do it that way, thanks anyway.

    Motion Videos UK – We are creative video designers who bring pleasure, meaning and beauty to our small world through film, motion graphics and animation.

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