You can access the velocity of the camera’s position with:
thisComp.activeCamera.transform.position.velocity
or if applied directly to the camera:
transform.position.velocity
or if applied directly to the camera’s position:
velocity
🙂
Note that a velocity is a vector, so you will be receiving an array with 3 components (x, y and z). My guess is what you’d rather do is find the speed at which your camera is moving, which is a scalar that corresponds to the magnitude of the velocity. For speed use:
thisComp.activeCamera.transform.position.speed
transform.position.speed
speed
Once you have the speed, you can alter the value in order to end up with the frequency and amplitude of your wiggle. If applied to your camera’s position property:
f = linear(speed, 0, 3000, 0, 5); //as the camera's speed changes from 0 to 3000 pixels per second, increase the frequency from 0 wiggles per second to 5
a = linear(speed, 0, 3000, 0, 50); //as the camera's speed changes from 0 to 3000 pixels per second, increase the amplitude of the wiggle from 0 to 50 pixels
wiggle(f,a); //apply the wiggle
This code isn’t perfect, as wiggle will change it’s results proportionally faster with the rate of change of the frequency, so you’ll actually get more shake during periods of acceleration than during periods of high speed (where there will also be a good amount of shake, but not as much as during acceleration/deceleration).
Darby Edelen