Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Keyframes on slider in main comp not affecting pre comps as expected.

  • Keyframes on slider in main comp not affecting pre comps as expected.

  • Darren Michael

    March 9, 2023 at 2:22 pm


    Have set up a slider in a main comp to control some position animations in a precomp. It works until I add keyframes, then nothing. I think I need to add a valueAtTime expression to offset the start time of the precomp (which starts in the main comp at 11.19 seconds). Thing is I don’t know which parameter or comp I would need to add the ValueAtTime expression.


    The set up is a simple slider control in the main comp to control the x position of a few layers in the pre comp. the layers I want to control are all connected to the slider and work until the keyframes are set. If I move the precomp to the very start of the Main comp, all works perfectly, even with keyframes. Where do I put the expression and what is the expression syntax I would need to add?


    Thanks in advance.


  • Dan Ebberts

    March 9, 2023 at 4:52 pm

    You have to work it into the expression that links a property in the precomp to the slider in the main comp. If it’s just a simple link, it could look like this:

    C = comp("main comp");
    ctrl = C.layer("controls").effect("Slider Control")("Slider");
    L = C.layer(;
    ctrl.valueAtTime(time + L.startTime)

  • Darren Michael

    March 10, 2023 at 10:07 am

    Thanks Dan. I still can’t ascertain how to get it to work.

    So…..the expression I have in one of the precomp layers (called Character 1) linking to the slider within the main comp (called Infinity) is:

    comp(“Infinity”).layer(“Head Rotation”).effect(“x Position”)(“Slider”);

    I vaguely understand what the code you posted relates to but don’t fully know how to apply that. I thought I’d changed the syntax from what you’d posted to reflect my comps but get an error at line 1.

    C = comp(“Infinity”);

    ctrl = C.layer(“Head Rotation).effect(“x Position”)(“Slider”);

    L = C.layer(thisComp.Character 1);

    ctrl.valueAtTime(time + L.startTime)

    I’m clearly doing something rather dumbass

  • Dan Ebberts

    March 10, 2023 at 5:08 pm

    Try it like this:

    C = comp("Infinity");
    ctrl = C.layer("Head Rotation").effect("x Position")("Slider");
    L = C.layer(;
    ctrl.valueAtTime(time + L.startTime)
  • Darren Michael

    March 17, 2023 at 2:45 pm

    Thank you Dan. Sorry for late reply, but this did the trick!

Viewing 1 - 5 of 5 posts

Log in to reply.

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