Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression to drive wiggle by velocity?

  • Expression to drive wiggle by velocity?

    Posted by Joel Witmer on May 21, 2010 at 8:02 pm

    Can anyone please explain how I can set the wiggle amount and frequency so that it is driven by the velocity of the camera movement? So the faster the camera moves over time, the more camera wiggle there would be and vica versa.

    I’m new to expressions so while I have an idea of what I need to do I can’t seem to figure it out exactly.

    Thanks!

    Joel Witmer replied 15 years, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Darby Edelen

    May 21, 2010 at 10:24 pm

    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

  • Joel Witmer

    May 24, 2010 at 5:37 pm

    Thanks so much Darby!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy