ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# How to add two expressions to a single property?

FAQ   •   VIEW ALL How to add two expressions to a single property? on Apr 30, 2017 at 4:09:10 pm

I have a camera that is set to orbit around a null object so I just move the null, not the camera. I then wanted to add a wiggle and a bouncing expression to it so as to add a little life to the movements. My solution was adding the expression (as you see below) to the property "Position" in the null. It will only apply the second expression ignoring the first one, be it the wiggle or the inertial bounce (I tried it backwards). It did work in a previous file the first time a tried it. What am I doing wrong?

```// Inertial Bounce (moves settle into place after bouncing around a little) 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){ v = velocityAtTime(key(n).time - thisComp.frameDuration/10); amp = .05; freq = 4.0; decay = 2.0; value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t); }else{ value; } wiggle(0.25,50)```

 Return to posts index Re: How to add two expressions to a single property?on Apr 30, 2017 at 4:39:32 pm

Hi,

I think if you replace the end of your expression with this, it works :

if (n > 0){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
amp = .05;
freq = 4.0;
decay = 2.0;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t) + wiggle(0.25,50);
}else{
value+ wiggle(0.25,50);
}

I just added the wiggle to each value instead of putting it at the end.

Hope this helps.
Cheers !
;)

 Return to posts index Re: How to add two expressions to a single property?on Apr 30, 2017 at 7:23:39 pm

Since wiggle includes the property value, it should probably be like this:

v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t) + wiggle(0.25,50);
}else{
wiggle(0.25,50);
}

Dan

 Return to posts index Re: How to add two expressions to a single property?on Mar 14, 2019 at 1:03:57 pm

hello, what if the first expression is a bounce and the second a wiggle, but on the scale, and you want to keep scale proportions?

below is the expression I need to modify to have a wiggle of
w = wiggle(5,7);
[w,w]

As it is now I'm using it on rotation and it works fine. I get a nice bounce that instead of ending it turns into a nice smooth wiggle.
When I copy it on scale it works, but of course it doesn't keep the proportions and plus it double the size of the object.

Thank you

```amp = .3; freq = 2.0; decay = 3.0; n = 0; time_max = 4; 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){ v = velocityAtTime(key(n).time - thisComp.frameDuration/10); amp = .3; freq = 2.0; decay = 3.0; value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t) + wiggle(1,1); }else{ value+ wiggle(1,1); }```

 Return to posts index