So I’ve got this comp with a rectangle where width is controlled by a slider, so it always starts at 0 for the first key frame and ends at 200 for the last one, which lasts 1 second.
How can I make it obtain the value from the json instead of manually adjusting the last keyframe value of the slider, which is 200? So for example if the pulled data is 100 then animate from 0 to 100 e.t.c.
I usually use JSON data to change source text but not sure how can I use as a keyframe value like for this instance.
It’s a little complicated because an expression can’t just replace the value at a keyframe, it needs to replace every value. The simplest change would be construct your own linear ramp, using the slider keyframes to provide the timing info and the first value and your data file to provide the second value. That could look like this (not tested, so there may be typos):
val = footage("value.json").dataValue();
rect = thisComp.layer("Null 1").effect("Slider Control")("Slider");
linear (time,rect.key(1).time, rect.key(2).time, rect.key(1).value, val);
But it seems like you could clean this up and get rid of the slider altogether, but you’d have to get the timing info from somewhere else (or hard code it).