-
Change Value on Previous Keyframe in Index, not Nearest
I have an expression on a Null slider (“Magazine control”) that I want to add 25 to the value of every time I add a keyframe to another slider on the same Null (“Magazine Reload”). Currently I have it mostly working except it’s changing when it’s closer to the next keyframe than it is to the previous, and I want it to change only when it hits the next keyframe, not when it’s closer, so I need to reference the previous keyframe instead, and I’m not sure how to do that.
Here’s my expression currently (applied to the “Magazine control” slider effect):
reload = effect(“Magazine Reload”)(“Slider”).nearestKey(time).index;
Math.round(value)+(25*reload);I found a couple other forum posts referencing previous keyframes in expressions, but I couldn’t figure out how to translate them to my problem.
reload = effect("Magazine Reload")("Slider").nearestKey(time).index;
Math.round(value)+(25*reload);