-
Adding decay that clamps at a certain value without altering subsequent animations
Hello Creative Cow! I have been a long time lurker and am usually able to find solutions to my problems by browsing previous posts, but I have hit a roadblock.
I have been following Dan Ebberts’ guide to driving acumulative animation through audio in order for me to mimic Trapcode Sound Keys. I have gotten great results thus far, but I can’t figure out the right way to add decay. I currently have my value increasing by x everytime my beat counter detects a beat. X being a slider control for amplitude. I want to add decay so that this number is constantly decaying until it hits the original “size” variable at which point the value stays at that until the next beat which should increase the value by the amplitude.
Dec is constantly increasing with time and when I try to clamp that value to not be less than “size” it has to play catch up with every single beat. This means that if I get to a point where there aren’t a lot beats going on in the song the next beat won’t actually cause any value changes until part of my expression outputs a value that is > the constantly decreasing decay.
How can I set this up so that the decay stops when it makes the value < “size” and that it won’t mess up any subsequent values driven by the beat?
I am very sorry if this isn’t clear, describing this stuff is difficult!
size = effect("Size")("Slider");
amp = effect("Amplitude")("Slider");
cnt = effect("Beat Count")("Slider");
dec = (effect("Decay")("Slider")*time);
s = size+((amp*cnt)-dec);
[s,s]