Copy link to clipboard
Copied
I'm trying to control the scale through an if statement expression. Innitially I tried to only control the Y Axis but that wasn't working
Here was the first expression i tried:
x = if(thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider") < 4){102}else{100};
[value[0],x]
Then I tried to not control the individual dimensions incase I had written something wrong there.
This was the next expression which isn't giving me an error, but is ignoring the if statement completely.
temp = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
if(temp < 4){102}else{100};
[temp, temp].
What I'd like to do, is control the Y property by looking to a continuously changing slider so whenever the value is greater the 4 that the scale changes from 100 to 102.
Please help, thanks 🙂
Copy link to clipboard
Copied
You need to assign the values to a variable:
if(thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider") < 4){
x = 102 //' same for 'temp'
}else{
x = 100 // Same for 'temp'
};
[value[0],x]
Copy link to clipboard
Copied
I think you have more problems than just the formatting issue. Audio levels typically run from 0 to 30. Four is a very low threshold for most audio and the change from 100 to 104 isn't much so you are not going to get much of a reaction.
Another problem is that a simple if statement is on or off. Your scale would either be 100% or 104%, which is hardly enough of a change to give you much of a change in size unless you just want a small vibration that rattles only when the sound level dips below a very low background noise level.
I would consider using an interpolation method. The first step is to open the Audio Levels Both Channels Slider in the Graph editor set to display a value graph, then look at the range and figure where you want the switch to take place. Then you build your interpolation method.
This tutorial I just released explains it all pretty well.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more