Copy link to clipboard
Copied
I am creating a graph that animates on. Each of my bars is animating on by using trim paths. I have an expression that connects the percentage # and the bar so that the percentage listed matches up to the growth as the bar animates on. I want to add a little bounce to each bar, but I already have one expression added to my trim path which rounds the percentage. When I paste in another expression to add a bounce to the trim paths, it does not work. Can you add more than one expression to a trim path and if so, how do you do so?
Copy link to clipboard
Copied
You don't just add multiple expressions to a property, you refactor the code. That's the whole point. Unless the internal functions are specifically tailored to be "aware" of each other, they won't interact or one expression will override the result of the previous function. that and of course AE has specific limitations in terms of how expressions evaluate or for that matter its general structure. In any case, without seeing your actual setup and code nobody can advise on how to possibly make it cooperate. You have to provide that info by posting screenshots and such.
Mylenium
Copy link to clipboard
Copied
Thanks for the explanation. That's exactly the information I was searching for. I thought it was strange that I could watch video after video about adding expressions, but nothing about how to work with more than one. I edited my comment yesterday but it appears that the attachments still didn't make it in. Hopefully, this will work. The two pieces of code I'm working with are the following:
Rounding to the next number:
Math.round(value)
Bounce:
amp = 5.0; freq = 2.0; decay = 4.0;
n = 0;
if (numKeys > 0) {
n = nearestKey(time).index;
if (key(n).time > time) { n--; }
}
if (n == 0) { t = 0; }
else { t = time - key(n).time; }
if (n > 0 && t < 1) {
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*(amp/100)*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}
else { value; };
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more