-
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,
Adam
if (effect("Checkbox Control")("Checkbox") >0) {
linear(time,effect("Checkbox Control")("Checkbox").nearestKey(time).time,effect("Checkbox Control")("Checkbox").nearestKey(time).time+2,0,100);
}else{
value
}