Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Randomly Change Speed Throughout Animation/Video Loop

  • Randomly Change Speed Throughout Animation/Video Loop

    Posted by Matthew Leonard on July 29, 2014 at 2:20 am

    Seems like a simple expression, but I can’t find how to do it(been Googling it on and off for a day or so). Pretty new at expressions, but I’ve tried using wiggle, things like seedRandom, and Random() with time remapping which gave some pretty wacky results. Pretty much what I’m going for is something like this. The video plays 100%, then the speed of the video/animation gradually goes to say 150% speed for x amount of seconds, then back to 100% speed or 50% for x amount, then 75% x speed and so on. Not looking for a super complicated way of doing it, but just at random times for x amount of seconds(even varying x amount of seconds would be great too). Kind of think about it as wiggle, but with gradual speed and hold. I hope that I’ve explained it thoroughly enough, and any help would be appreciated.

    Matthew Leonard replied 12 years, 1 month ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    July 29, 2014 at 5:55 pm

    It’s not simple. If you’re using time remapping, you expression has to calculate total time elapsed, which means on each frame it has to re-calculate all time that has elapsed in the past and add to that the contribution of the current frame. This might help, but again, it’s not simple:

    https://www.motionscript.com/articles/speed-control.html

    Dan

  • Matthew Leonard

    July 29, 2014 at 7:12 pm

    Thanks for replying Dan. I’ve been looking at you’re website all last night(which is terrific by the way, very comfortable with expressions now) and I think I found what I’m looking for. I found a way around it by using the TimeWarp plugin, but I can’t seem to get the hold to work properly. Also, how would you get different statements into the hold command? So something like these(examples of how it is in my mind, it’s not exact but just the idea):

    If (segDur > 5 || segDur < 5) (segDur = 2+holdDur = 1) else(segDur = 10)

    If (effect(“Timewarp”)(“Speed”) > 130) (holdDur = 5) else( Continues with random speed )

    I’m using the motion script from your website, and these are the only two things I need to get this to work. I hope that this makes sense, and should(hopefully) be a lot less complicated than using time remapping.

    segDur = 10
    minVal = [80]
    maxVal = [150]
    seed = Math.floor(time/segDur);
    segStart = seed*segDur
    seedRandom(seed,true);
    startVal = random(minVal,maxVal);
    seedRandom(seed+1,true);
    endVal = random(minVal,maxVal);
    ease(time,segStart,segStart + segDur, startVal, endVal)

    If (segDur > 5 || segDur &lt; 5) (segDur = 2+holdDur = 1) else(segDur = 10) //Theory

    If (effect("Timewarp")("Speed") > 130) (holdDur = 5) else( Continues with random speed ) //Theory

  • Dan Ebberts

    July 29, 2014 at 7:53 pm

    I had forgotten all about Timewarp. Maybe something like this:


    minRamp = 1;
    maxRamp = 2;
    minHold = 2;
    maxHold = 5
    minSpeed = 80;
    maxSpeed = 150;
    t = tSave = 0;
    seed = 117;
    while (t <= time){
    seedRandom(seed,true);
    hold = random(minHold,maxHold);
    ramp = random(minRamp,maxRamp);
    tSave = t;
    t += hold + ramp;
    seed++;
    }
    if (time >= inPoint){
    spd = random(minSpeed,maxSpeed);
    if (time < tSave + hold){
    spd;
    }else{
    seedRandom(seed,true);
    random();
    random();
    nxtSpd = random(minSpeed,maxSpeed);
    linear(time,tSave+hold,tSave+hold+ramp,spd,nxtSpd)
    }
    }

    Dan

  • Matthew Leonard

    July 29, 2014 at 8:17 pm

    Simply awesome and does exactly what I want, thanks Dan!

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