Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to control an animation using a slider but keep the animation properties.

  • How to control an animation using a slider but keep the animation properties.

    Posted by John Pritchett on November 8, 2011 at 10:03 pm

    I am a long lime user of AE but relatively new to expressions past the ‘wiggle’ control, and need a little help please.
    I need to have a layer controlled by, I guess a slider, after the animation of that layer completes.
    Let me explain:
    I have 10 layers revealing in a fan using the Radial Wipe Transition. The initial wipe animates over 12 frames but then the ‘fan’ animates slowly for a ‘client defined’ duration. This is where I need a slider.
    Layer 1 is a solid with a radial wipe transition beginning at 100% and animating to 24% over 12 frames. I need this animation to always remain. What I need the slider to do is determine what happens next. I have 10 layers to apply this to, with each layer different values.
    I guess the expression would be applied to the Transition Completion to state – Clamp from 24% – say 80%. Obviously if I apply this directly to the slider, the slider controls the first part of the animation which I need to always remain the same.
    Is this possible? For a layer to animate, then a slider take control?
    Thanks for your help in advance.

    No expression code...yet...

    John Pritchett replied 14 years, 6 months ago 2 Members · 14 Replies
  • 14 Replies
  • Dan Ebberts

    November 8, 2011 at 11:53 pm

    Assuming that you’re using two keyframes for the first part of the animation, an expression for Transition Completion like this should work:


    if (numKeys > 1){
    if (time < key(2).time){
    value;
    }else{
    s = effect("Slider Control")("Slider") ;
    Math.max(valueAtTime(key(2).time),s);
    }
    }else{
    value;
    }

    Dan

  • John Pritchett

    November 9, 2011 at 12:12 am

    Thanks Dan for your reply , however this is over my head….
    Am I keyframing the layer with the radial wipe effect, or the slider controller?

  • John Pritchett

    November 9, 2011 at 12:27 am

    I think maybe what I need it the same animation (controlled by the slider) applied to every layer, but staggered by 10frames in time….
    If I keyframe the slider between 2 points, how can I ‘delay’ this in time for each layer?
    Thanks

  • Dan Ebberts

    November 9, 2011 at 3:20 am

    If your keyframed slider was on a null at the bottom of the layer stack, something like this should work tor the Transition Completion expressions:

    f = 10; // delay frames
    delay = framesToTime(f*index-1)
    thisComp.layer(“Null 1”).effect(“Slider Control”)(“Slider”).valueAtTime(time-delay);

    Dan

  • John Pritchett

    November 9, 2011 at 5:08 am

    Thanks Dan.

    This worked!!! with a bit of tweaking. Thanks.
    My next mind bender is the code below. I just can’t figure out why it wont work.
    I am attempting to control a second Radial Wipe from the first Radial Wipe inversely. As in 100=0 or 60=40 etc.
    This example is applying the ‘inverse calculation but from itself, not the first “Radial Wipe”

    Why wont this work???

    Thanks

    effect("Radial Wipe")("Transition Completion");linear(value,0,100,100,0)

  • Dan Ebberts

    November 9, 2011 at 7:22 am

    Your expression picks up the value from the radial wipe, but then doesn’t use it. This would be better:

    wipe = effect(“Radial Wipe”)(“Transition Completion”);
    linear(wipe,0,100,100,0)

    or, just

    100 – effect(“Radial Wipe”)(“Transition Completion”);

    Dan

  • John Pritchett

    November 10, 2011 at 12:55 am

    Sweet, All done. Thanks for your help Dan.

  • John Pritchett

    November 10, 2011 at 4:50 am

    So what I have done all works, but I am struggling with a random element to put into this expression.

    Expression is
    wipe=effect(“Radial Wipe”)(“Transition Completion”);
    linear(wipe,0,100,80,0);

    How am I able to randomize the ’80’ value by a variance of +- 7?
    NOT over time either (wiggle), just set randomly?

    Thank you very much for all your help!!!

    wipe=effect("Radial Wipe")("Transition Completion");
    linear(wipe,0,100,80,0);

  • Dan Ebberts

    November 10, 2011 at 4:58 am

    This is one way:

    seedRandom(index,true);
    maxVal = 80 + random(-7,7);
    wipe=effect(“Radial Wipe”)(“Transition Completion”);
    linear(wipe,0,100,maxVal,0);

    Dan

  • John Pritchett

    November 10, 2011 at 10:12 pm

    One again, Thank you. This worked sweet, but how does AE randomize it?
    It seems to be choosing a value and never changing it.
    If I wanted the random value ie -7,7 vary over time, but not wiggle, just increase over time?
    You are a genius you know…

Page 1 of 2

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