FORUMS: list search recent posts

Camera Z Position move faster on a beat

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ole Peters
Camera Z Position move faster on a beat
on Aug 8, 2015 at 4:54:21 pm
Last Edited By Ole Peters on Aug 8, 2015 at 5:37:52 pm

Hello,
I'm looking for an expression, which let's the camera move faster on the Z axis when a beat/peak of the Audio Amplitude in the composition "Music" appears and not move backwards after the beat again.
I'm this far with the expression already:
temp = transform.position[0];
temp1 = transform.position[1];
temp2 = transform.position[2]+time*20;


[temp , temp1 , temp2]



Help is appreciated.
-Ole


Return to posts index

Dan Ebberts
Re: Camera Z Position move faster on a beat
on Aug 8, 2015 at 6:05:24 pm
Last Edited By Dan Ebberts on Aug 8, 2015 at 6:05:38 pm

This might help:

http://www.motionscript.com/articles/speed-control.html#other-applications


Dan



Return to posts index

Ole Peters
Re: Camera Z Position move faster on a beat
on Aug 8, 2015 at 6:21:10 pm

Since I don't really want to put the whole thing in a Pre-comp and use time remap I thought it might work with the camera too.
I get an error message saying:"Can't appear on the left hand side of assignment, because it's read-only"

Please note, I'm kind of new to expression writing so I don't know how I should alter the expression on the site.

Ole


Return to posts index


Dan Ebberts
Re: Camera Z Position move faster on a beat
on Aug 8, 2015 at 6:34:17 pm

Try changing the last line to this:

value + [0,0,accum*mult]


You'll probaly also want to increase the value of the mult variable (I'd start with 100).

Dan



Return to posts index

Ole Peters
Re: Camera Z Position move faster on a beat
on Aug 8, 2015 at 6:48:33 pm

It works fine so far, but it still moves backwards after it moved forward.
Any ideas?


Return to posts index

Dan Ebberts
Re: Camera Z Position move faster on a beat
on Aug 8, 2015 at 8:51:46 pm

Are you animating the camera in some other way as well?

Dan



Return to posts index


Ole Peters
Re: Camera Z Position move faster on a beat
on Aug 8, 2015 at 10:30:24 pm

The Expression I use is
temp = transform.position[0];
temp1 = transform.position[1];
temp2 = transform.position[2]+time*20;


[temp , temp1 , temp2]


So the Camera is moving forward on the Z axis.
I added your expression like this:
temp = transform.position[0];
temp1 = transform.position[1];
temp2 = transform.position[2]+time*20+YourExpression;


[temp , temp1 , temp2]

Assuming that it'll accelerate the Camera on a beat of the Audio Amplitude.

Ole


Return to posts index


Dan Ebberts
Re: Camera Z Position move faster on a beat
on Aug 8, 2015 at 11:16:21 pm

This should be all you need:


z = time*20;
spd = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
mult = 100;
n = spd.numKeys;
if (n > 0 && spd.key(1).time < time){
accum = spd.key(1).value*(spd.key(1).time - inPoint);
for (i = 2; i <= n; i++){
if (spd.key(i).time > time) break;
k1 = spd.key(i-1);
k2 = spd.key(i);
accum += (k1.value + k2.value)*(k2.time - k1.time)/2;
}
accum += (spd.value + spd.key(i-1).value)*(time - spd.key(i-1).time)/2;
}else{
accum = spd.value*(time - inPoint);
}
value + [0,0,z+accum*mult]



Again, you may want to adjust the value of mult (in the 3rd line)


Dan



Return to posts index

Ole Peters
Re: Camera Z Position move faster on a beat
on Aug 8, 2015 at 11:54:34 pm

Works like a charm! You are awesome Dan!
I kind if feel like a douche now, I forgot to say that a little treshold in the expression would be good. Is it possible to add it in the expression?
I'm really sorry, I forgot it completely.

Ole


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]