Animating a slider control with a checkbox
I'm working on a project right now where I'm using a set of sliders to control various puppet pin positions. When you animate a slider the puppet takes a shape, a different slider a new shape.
What I need it to do now is automatically animate the slider from 0-100 over an arbitrary amount of time (I'm testing right now with 2 seconds) whenever a checkbox is keyframed On, and animate 100-0 when it's checked off.
So far I've been able to get the slider to animate 0-100 using the added expression, I'm using linear() to change the values, and am defining the in and out points via nearestKey(time).time and nearestKey(time).time+2
This works like expected, but as we approach an off keyframe for the checkbox, the value suddenly jumps from 100-1 in a single frame, well before we are even close to the next keyframe.
Any help is appreciated,
It will probably be something like this:
Thanks Dan, that worked for the checkbox, I actually found something similar last night that you posted to another thread about scaling with a checkbox.
Basically what I'm trying to set up is "Blendshapes" like you would see in a 3d program like maya. I have a mouth puppet rig set up and am trying to make it simple for lip sync later on.
As I kept building the rig I realized I needed to have multiple sliders to trigger at different times, from one set of keyframes. So I've changed the checkbox control for a different slider that's using hold keyframes, I've posted the modified script below.
So on keyframe.value 10, the first slider fires and moves from 0-100, but all the other sliders do their 100-0 animation. Any keyframe that isn't the correct trigger for that slider makes it do it's second animation.
So now I'm trying to find a way to only have them animate 100-0, if they were either already at 100, or if the previous keyframe was their trigger.
Actually I seem to have got it working now, it's not ideal but I think it'll do for the project I am working on.
Now when it looks at the value of the nearest keyframe, and it's equal to the value it wants (in this case 10) it starts the 0-100 animation. When the nearest keyframe changes to something else, it looks at the previous keyframe to see whether it was the value it wanted (10) before firing the 100-0 animation.
This keeps all the expressions from firing the 100-0 animation before they are at 100.
There are still some issues, you need 2 keyframes at the start of the animation, I used frame -1 and -2, or else the the expression will attempt to evaluate a keyframe and receive an error.
Also, if you try have 2 keyframes that are the same in a row, the second one restarts the animation back to 0-100 even though the value was already 100.
For this puppet rig I'm working on I don't think it will cause any problems, but if anyone knows an easy solution for these problems I'm all ears.