Thanks for that, maybe I should have been more clear in my original post but that appears to only show things like the scale. In the video the scale doesn't appear to change, only the position of the upper part of the triangle. That was what I was wanting to know how to do, like change the Y/X position of an object depending on how loud or quiet the sound was.
you can do the same thing with position or any other value. just separate the dimensions first, and attach the Y axis to the audio amplitude slider. you might want to add "value-" so you can easily adjust the initial position, and for the layer to go up instead of down:
value-thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")
If you are using the Keyframe assistant to turn audio into keyframes you get a set of values that can be applied to anything you like. Try this:
- Select your audio layer and then use Animation>Keyframe Assistant>Convert Audio to Keyframes
- Select the Audio Amplitude layer that is created and press the U key to reveal the keyframes
- Select Both Channels>Slider and then turn on the graph editor
- Observe the low and high values of the audio and record those values on a post it note
- Reveal the position property of the layer you want to react to the sound and then select position, hold down the Alt/Option key or go to Animation>Add Expression and click to start an expression
- type t = and then drag the pickwhip from the expression controls to the Both Channels Slider property of the Audio Amplitude layer and release, then add a semicolon ; and press return
- type x space =
- From the Expression Language menu (little white circle with a black arrowhead just to the right of the pickwhip) choose Interpolation>ease(t, tMin, tMax, value1, value2)
- t is the value from Both Channels Slider in the Audio Amplitude layer
- Change tMin to the minimum value you want to use for the start of the movement from your post it note - say 2.2
- Change tMax to the maximum value you recorded on your post it note from the graph editor - say 12.7
- Change value1 to the minimum value you want to layer to move in the x direction - say -100
- Change value 2 to the maximum value you want to move the layer in the x direction - say 250
- Add a semicolon ; at the end of the line and press return
- type y = value to keep the y position value of your layer as it's original value (or repeat the procedure you just did for x) and add a semicolon to the end of the line and press return
- Set up your position array by typing [value to read the current x position
- Add + x , y]
- You're done.
Your expression looks like this:
t = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
x = ease(t, 2.2, 12.7, -100, 250);
y = value;
[value + x, y]
The motion of your layer looks like this: (x motion is in red)
Having the graph editor properly set up and editing your expressions in right there makes it easy to see exactly what happens as you change the values.
An expression like this is the first step in learning expressions. You can control any property you can find in After Effects as a number or any color you see as a color chip with an expression. You just have to learn how to use the language. Any numeric value or color is an array. The standard array is [x, y, z] with x being value, y being value and z being value. Some properties like color have 4 values, some have 2. Switches and check boxes have one value either 0 or 1 for off and on. You can figure out the array by looking at how the values are displayed in the timeline.
If you do not see numbers or a color chip, like curves or mask path keyframes, then you generally cannot control or read values from that property.
To learn more about expressions please take time to type expressions in the search help field at the top right corner of AE and spend some time studying up. Basic expression skills will lighten the workload on many different kinds of projects.