Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions using an expression on a slider to control visibility of layers inside a precomp

  • using an expression on a slider to control visibility of layers inside a precomp

    Posted by Al Michaels on September 21, 2017 at 10:57 am

    Hello

    I’m very new to writing expressions. I have a project where I have over 100 pictures that need to animate in. To save time and incase the client changes their mind i wanted to use an expression to turn on and off each layer via opacity.
    The heirachy is as follows,
    –Main Comp – Contains Precomp B and an adjustment layer with a slider attached
    — Precomp B – Contains Precomp A which has been animated in this comp
    —–Precomp A – Contains All the images.

    My plan was to use the slider 0-100 numbers to select which picture i would like to see, so basically use the slider as a selector which i can animate

    I cant seem to find much online about it and would love any help anyone has to offer!

    cheers

    Scott Mcgee replied 8 years, 11 months ago 2 Members · 3 Replies
  • 3 Replies
  • Scott Mcgee

    September 21, 2017 at 11:29 am

    Precomp A – Inside Precomp A, set all images to 1 frame each
    Main Comp – Add Null object, doesn’t really matter what you add, but a Null is invisible. Then add a slider to the Null.
    Precomp B – Add time Remap to Precomp A, with the following expression below.

    sliderPos = comp(“Main Comp”).layer(“Null”).effect(“Slider Control”)(“Slider”);
    framesToTime((Math.round(sliderPos)))

    I’m going based off memory at the moment, but that should work for you.

  • Al Michaels

    September 21, 2017 at 1:28 pm

    Thanks Scott!

    this works! however another issue has arisen.

    if i then key frame the slider. and duplicate Precomp B the pictures then restart as the sequence when actually i want them to continue with what i have key framed.

    This obviously makes sense however is it possible to make them not ‘restart the timeline’

    I hope this makes sense

    all the best

    al

  • Scott Mcgee

    September 21, 2017 at 8:56 pm

    If you use true comp duplicator, then its a bit easier.

    all i can advise thinking off top. Animate Precomp A instead, unless there is a reason. Add slider to Precomp A. So when you duplicate so does the slider control. time remap expression will always look to the attach slider. so you can change these individually.

    if you want to control each of these from the master, just pick whip the duplicate to a new slider in the master comp. A little messy but get around the duplication issue.

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