-
Holding a value
Okay. So, both me and my partner are complete and utterly new to the expression world, because for the most part, we use very few expressions in the first place.
What we’re essentially trying to do, is create a videogame health-bar, and it goes down every time an audio que plays.
We know how to make it go DOWN when the audio plays, but then it goes back up to the original value instead of staying down, and then adding more, and more as each audio que plays.
This is our current code, and yes, it’s probably horrible. Like I said, we barely know what we’re doing. The problem we’re having is it isn’t holding the current value when it adds the 10 to the linear wipe we’re using to tick the health bar down. I feel like this should be simple, but we’re not sure. ANY help would be greatly appreciated.
Notes about it:
– “audio” is the keyframes from the audio layer, made easier by Sound Keys
– counter being set to 51, is because the linear wipe doesn’t make a visual difference until it goes up to 52, and then it ends at 94 (yes I’m aware
of how dumb that seems).
-audio > 35 is the threshold for when we want the health to tick down, and by 10(%) we want it to go down every time it hits. We were thinking
that with an else of “counter + 0” we thought it would just keep the value, and then anything else is that isn’t over that threshold of 35 wouldn’t
add anything.
This of course wasn’t the case.audio = thisComp.layer("Null 1").effect("Sound Keys")("Output 1");counter = 51;
if (audio > 35) counter + 10; else counter + 0;