Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects overiding an expression after x secs

  • overiding an expression after x secs

    Posted by Michael Goldberg on August 11, 2009 at 12:07 pm

    Hi,
    I’ve used some of Dan Ebbert’s great resources on Motion Script.com, and have an expression to randomly move an object along it’s Y axis. I’d like to have the randomness stop after say 4 sec’s and have the layer move to it’s fixed position. Is there a way to override the expression without using separate layers?
    Here is the expression I used.

    Mike

    segMin = .3; //minimum segment duration
    segMax = .3; //maximum segment duration
    minVal = -500;
    maxVal = 200;

    end =0;
    j = 0;
    while ( time >= end){
    j += 1;
    seedRandom(j,true);
    start = end;
    end += random(segMin,segMax);
    }
    endVal = random(minVal,maxVal);
    seedRandom(j-1,true);
    dummy=random(); //this is a throw-away value
    startVal = random(minVal,maxVal);
    x = position[0];
    ease(time,start,end,[x,startVal],[x,endVal])

    Curious Turtle replied 17 years ago 2 Members · 1 Reply
  • 1 Reply
  • Curious Turtle

    August 11, 2009 at 8:39 pm

    You could add a Slider Control effect and keyframe that from 100 to 0. Just tweak your expression to:

    segMin = .3; //minimum segment duration
    segMax = .3; //maximum segment duration
    minVal = -5*effect("Slider Control")("Slider");
    maxVal = 2*effect("Slider Control")("Slider");

    end = 0;
    j = 0;
    while ( time >= end){
    j += 1;
    seedRandom(j,true);
    start = end;
    end += random(segMin,segMax);
    }
    endVal = random(minVal,maxVal);
    seedRandom(j-1,true);
    dummy=random(); //this is a throw-away value
    startVal = random(minVal,maxVal);
    x = position[0];
    ease(time,start,end,[x,startVal],[x,endVal])

    That will give you the control you want.

    Cheers,
    Ben

    Curious Turtle Pro Video
    Training | Editing | Support

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