FORUMS: list search recent posts

Using Slider value to change hold keyframe value

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sash McCartney
Using Slider value to change hold keyframe value
on Jun 10, 2015 at 5:24:15 pm

Hi All,

Hopefully someone can help me. I have spent half a day trying to get this expression to work and have trawled the forum looking for a similar issue but to no avail.

I have a precomp containing 5 images all 1 frame long ordered sequentially so that frame 1 is image 1 frame 2 is image 2 and so on.

Basically I want to use the value of a slider, which is based on convert audio to keyframes, to change the hold keyframe value on my pre-comp.

What I want to happen is that everytime the slider value is greater than 7 the hold keyframe on the precomp moves to the next image.
As far as I can tell the code shown should set the hold key frame to zero when the playhead is at the start of my comp. And then if the value is greater than 7 it should add 0.04 (1 frame in seconds at 25fps) to the hold keyframe value therefore displaying the next image in the sequence. I'm sure I'm being stupid but at the moemnt it WON"T WORK, ARGHHH!

volume = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
if (time = 0) {
timeRemap = time;

if (volume > 7 ) {
timeRemap = timeRemap + 0.04;

Return to posts index

Dan Ebberts
Re: Using Slider value to change hold keyframe value
on Jun 10, 2015 at 6:41:35 pm

I think this will do what you want:

threshold = 7;
numImages = 5;

audioLev = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");

above = false;
frame = timeToFrames(time);
n = 0;
while (frame >= 0){
t = framesToTime(frame);
if (above){
if (audioLev.valueAtTime(t) < threshold){
above = false;
}else if (audioLev.valueAtTime(t) >= threshold){
above = true;



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved