Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random time remap

  • Posted by Rafael Braz on November 3, 2014 at 8:24 pm

    Hi there, I’ve been looking for an expression to make this work but still couldn’t find any that suits my needs.

    I have a 3 frames comp and I want the three frames to change randomly.
    But the expressions I tried flickered a lot, and I’d like to make the frames still for at least 10-20 frames.

    When I try something like

    It flicks like crazy and the weird is that one of the flickering frames is a blank one, I don’t get why that happens.

    For an insight of the project, it’s a title made of magazine cut offs letters.
    I have 3 cut offs for each letter. So I made a 3 frames comp for each letter intending to change it randomly with time remapping.
    So the expression should change randomly between these 3 frames, holding each one for at least 10-20 frames.

    Could anybody help me out here? I know very little of expressions, so basically I tried a lot of copy and paste from old topics and google researches, none of it works… 🙁

    Thanks!!

    fr = 12; // frame rate;
    numFrames = 8;
    seedRandom(index,true);
    seg = Math.floor(time*fr);
    f = Math.floor(random(numFrames));
    for (i = 0; i < seg; i++)
    f = (f + Math.floor(random(1,numFrames)))%numFrames;
    framesToTime(f);

    Mathilda Germain replied 10 years, 10 months ago 3 Members · 20 Replies
  • 20 Replies
  • Rafael Braz

    November 3, 2014 at 8:28 pm

    Actually, this 3 years old expression I found works perfectly, but, I don’t know why, one of the frames is BLANK!
    Why’s that for god sake? :`(

    numFrames = 5;
    minDur = 15;
    maxDur = 30;

    f = timeToFrames();
    f0 = 0;
    seedRandom(index,true);
    while (f0 <= f){
    f0 += Math.floor(random(minDur,maxDur+1));
    }
    seedRandom(f0,true);
    framesToTime(Math.floor(random(numFrames)));

  • Dan Ebberts

    November 3, 2014 at 8:52 pm

    Try this one:

    frameDur = 15;
    f = timeToFrames(time);
    seg = Math.floor(f/frameDur);
    seedRandom(seg+1113,true);
    rf = Math.floor(random(3));
    framesToTime(rf)

    Dan

  • Rafael Braz

    November 3, 2014 at 9:01 pm

    It works dude!!!! Thanks!!!!

    Would it be too much to ask you how to make a slider or something to turn it on and off? So I can choose when I want the randomness to start and end?

  • Dan Ebberts

    November 3, 2014 at 9:52 pm

    That’s a little vague, but here’s a version with variables for start and stop times (tStart & tStop) which you could tie to sliders:


    tStart = 1;
    tStop = 3;
    if (time > tStart && time < tStop){
    t = time - tStart;
    frameDur = 15;
    f = timeToFrames(t);
    seg = Math.floor(f/frameDur);
    seedRandom(seg+1113,true);
    rf = Math.floor(random(3));
    framesToTime(rf)
    }else 0

    Dan

  • Rafael Braz

    November 5, 2014 at 8:40 pm

    Thanks a lot dude, I just had the opportunity to test it today.
    How do I exactly do it?
    I tried to paste the expression on both Slider and Time Remap, but I’m confused on how to relate them.

  • Dan Ebberts

    November 5, 2014 at 8:54 pm

    Add a couple of sliders, and change these lines:

    tStart = 1;
    tStop = 3;

    to something like this:

    tStart = effect(“Slider Control”)(“Slider”);
    tStop = effect(“Slider Control 2”)(“Slider”);

    Dan

  • Rafael Braz

    November 5, 2014 at 9:03 pm

    Nothing happens 🙁

  • Dan Ebberts

    November 5, 2014 at 9:34 pm

    Did you set the sliders to valid times?

  • Rafael Braz

    November 6, 2014 at 8:01 pm

    Yea, I tried 1, 3, or 0.01, 0.03, I dragged the slide all the way but nothing happened… :/

  • Dan Ebberts

    November 6, 2014 at 8:53 pm

    Does it work without the sliders (just pasting the original expression into time remapping)?

    If not, I probably didn’t understand what you’re trying to do.

    Dan

Page 1 of 2

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