Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Changing which precomp is loaded with a slider?

  • Changing which precomp is loaded with a slider?

    Posted by Jerome Laville on May 11, 2021 at 11:24 am


    I’m using my main composition as a template to generate several videos. The only thing that changes in each export is one precomp in that main composition.

    Right now, my process is:
    – Open main comp
    – Add in precomp “2” next to precomp “1”
    – Copy and paste the attributes/effects/keyframes from “1” to “2”
    – Remove precomp “1”
    – Export main comp
    – Repeat, each time adding a new precomp (from hundreds) and removing the old

    Is there a faster way to do that where, instead of having to manually replace precomp “1” with “2”, then “2” with “3” etc., I can maybe just use a slider on a Null that will determine which precomp is loaded in the main composition (given that they’re all named with just numbers)?

    Thank you.

    Eric Santiago replied 3 years, 2 months ago 3 Members · 6 Replies
  • 6 Replies
  • Eric Santiago

    May 11, 2021 at 1:19 pm

    Are all the precomps the same length?

    I do this a lot with templates and toggle on/off switch.

    Only works well if they are off the same lengths.

    Maybe look into the Essential Graphics Panel?

  • Jerome Laville

    May 11, 2021 at 1:31 pm

    Thank you for your response.

    Yep they are all the same length, size etc.

    Ideally I’d like a way to somehow just input “47” somewhere and the precomp called “47” will automatically be the one used in the main composition… Hmm…

  • John Cuevas

    May 11, 2021 at 6:02 pm

    This works if you go into your project settings and change Expressions to Legacy Extend Script

    Add null and a ‘Slider Control’ effect to it. Add the expression “Math.floor(value);” to the slider.

    Create a composition for all your precomps(All Precomps) and put all of them in it. In the final comp, click the slider control layer and lock the effect controls window so you can access the slider from another composition.

    In the first layer of ‘All Precomps’ open opacity, alt-click to add and expression and add

    if (pick whip to the slider) == thisLayer.index) 100 else 0

    Right click opacity and choose “copy expression”. Select all your other layers and paste the expression.

    Drop All Precomps into your main comp, use the slider to pick the layer you need turned on.

    See example file if anything is confusing.

  • Jerome Laville

    May 12, 2021 at 8:37 am

    John this is perfect, that does the trick. Thank you very much for your time and effort. Have a great day.

  • Eric Santiago

    May 12, 2021 at 2:07 pm

    Best tip of 2021 and possibly the last few years 😉

    I can see many ways of using besides the layer controls.

    Thanks, John!

  • Eric Santiago

    May 12, 2021 at 3:19 pm

    I dug into this code more and found the CLAMP VALUE option.

    My needs required more of a toggle approach (ON/OFF).

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