Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Lock keyframe value to be either 0 or 100

  • Lock keyframe value to be either 0 or 100

  • James Pierson

    May 14, 2022 at 8:39 am

    Hello,

    I’m hoping to find an expression that locks a slider keyframe value to either be 0 or 100 (no other/inbetween values), abit like a check box on/off but needs to be on slider controls..

    Many thanks!

  • Dan Ebberts

    May 14, 2022 at 3:20 pm

    I think we need more info. What determines whether the value is 0 or 100? What happens to the values between the keyframes? A before-and-after example would be helpful.

  • James Pierson

    May 15, 2022 at 9:11 am

    Hey Dan,

    Thanks so much for the reply, I really appreciate it. So to try to further explain what I’m trying to do:

    I have a precomp of a characters torso, in this precomp are 5 layers from Photoshop, each layer different artwork of angle of the torso (facing left, left 3/4, front on, right 3/4 and facing right). Each layer lasts for 1 second (an arbitrary length of time, just seemed cleanest) that are then sequenced one after the other, in order so torso turns from left to right.

    In the master composition I bring this torso precomp in, add a timeremap, so I can control which angle is shown with hold keyframes. I then create the arms which I’ll needs to control ‘live’ (which is why I can’t add them to the torso timeremapped comp) but obviously as the torso angle moves so does the shoulder position.

    So I create 5 hold keyframes on the torso for the different angles, and then for each angle add position keyframes for the two shoulder layers (left and right arms), so they all line up.

    Using a plugin called joy sticks and sliders, I’ve managed to create 5 sliders that these properties link up to (eg slider 1 has torso timeremap at 0 seconds, and shoulder positions at the correct position for that torso angle) and so on. Using hold keyframes to switch between these sliders (eg slider 1 is at 100, and all the others are at 0) works, but it’s not convenient to have to type either 0 or 100 into each slider value each time I make keyframes and then convert them to hold frames (if they were linear the torso would still switch between angles but the shoulders would animate between the positions), so I’m wondering if there’s an expression I can add that will snap the value to either 100 or 0 just be dragging the value arrow – which will help speed up animating.

    OR if there is a completely different way to set this up? In an ideal world I’d some how link all those initial properties to a null, which when it moves from left to right, so too does the torso/shoulders, snapping to the correct positions.

    Sorry for the long reply, hope I’ve shed some light on what I’m trying to accomplish.

    Thanks!

  • Dan Ebberts

    May 15, 2022 at 1:05 pm

    Without really seeing the details, my guess is “probably”, but I’m wondering if you wouldn’t be better off with a dropdown menu control that lists your 5 poses and then all your expressions reference that control. Then you’d just keyframe the control (hold keyframes happen automatically) and everything should snap into place via the expressions.

  • James Pierson

    May 15, 2022 at 2:08 pm

    Hi Dan,

    Really appreciate the reply again.

    I hadn’t heard of the drop down menu control before you mentioned it, having looked at some tutorials online it looks like it could prove very useful, and can see why you would recommend it for this situation. Although from the research I can see, I can’t find anyone linking multiple position properties (on the same layer) to the different drop down tiers. My expression knowledge is pretty limited so if its beyond simple pick whipping I don’t know where to begin tying to link all the properties up!

    I’ve attached a really simple AE mock up file, which would hopefully illustrate what I’m trying to achieve best )please forgive the awful aesthetic, it was done in haste for illustration purposes!) The keyframes that need to be tied to expressions are time remap keyframes, position keyframes and opacity keyframes.

    If you have time to look it over any insights would be greatly appreciated, if not then no worries and thanks for all your engagement so far!

  • Dan Ebberts

    May 15, 2022 at 2:57 pm

    This should help illustrate what I mean. I went into your “torso and arms – slider controls” comp and added a Dropdown Menu Control to the “body control” layer. I edited the control to have five entries with these names : “left”, “left 3/4”, “front”, “right 3/4”, “right”.

    Then I add this expression to the first Slider Control:

    ddm = effect("Dropdown Menu Control")("Menu").value;

    ddm == 2 ? 100 : 0

    this to Slider Control 2:

    ddm = effect("Dropdown Menu Control")("Menu").value;

    ddm == 3 ? 100 : 0

    this to Slider Control 3:

    ddm = effect("Dropdown Menu Control")("Menu").value;

    ddm == 4 ? 100 : 0

    and this to Slider Control 4:

    ddm = effect("Dropdown Menu Control")("Menu").value;

    ddm == 5 ? 100 : 0

    Then, whichever position you select with the dropdown, all the pieces move into place.

    I hope that’s helpful.

  • James Pierson

    May 18, 2022 at 12:11 pm

    Hi Dan,

    Very sorry for the delay, just wanted to say thanks for all your help with this – its really appreciated!

    Many thanks,
    James

Viewing 1 - 7 of 7 posts

Log in to reply.

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