-
How to Modify the “Triggering expression with audio”
Hello I am new to expressions , the motionscript.com site is very helpful , but whenever I try to modify an expression , I get stuck.
For example I looked for an expression to trigger animations with audio and got thisthreshold = 10.0;
audioLev = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);
above = false;
frame = Math.round(time / thisComp.frameDuration);
while (true){
t = frame * thisComp.frameDuration;
if (above){
if (audioLev.valueAtTime(t) < threshold){
frame++;
break;
}
}else if (audioLev.valueAtTime(t) >= threshold){
above = true;
}
if (frame == 0){
break;
}
frame–
}
if (! above){
t = 0;
}else{
t = time – frame * thisComp.frameDuration;
}amp = 25;
freq = 5;
decay = 4.0;angle = freq * 2 * Math.PI * t;
wobble = 1 + amp * Math.sin(angle) / Math.exp(decay * t) / 100;
[value[0] * wobble, value[1] / wobble]But how about if I want to change the wobble expression with something else like a random scale or position ? Meaning that a layer is displayed in a random position triggered with specified audio threshold.
Sorry If this is a stupid question , I am new and thanks Dan Ebberts for helping people like me.For random scale found that this worked perfectly for me ;
frame = Math.round(time/thisComp.frameDuration);
seed = Math.floor(frame/15);
seedRandom(seed,true);
s = random(50,100);
[s,s]and another one for random position and found this ;
holdTime = .5; //time to hold each position (seconds)
minVal = [0.1*thisComp.width, 0.1*thisComp.height];
maxVal = [0.9*thisComp.width, 0.9*thisComp.height];seed = Math.floor(time/holdTime);
seedRandom(seed,true);
random(minVal,maxVal)
Sorry, there were no replies found.