FORUMS: list search recent posts

# 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)```

 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 !
;)

 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