Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions blend random value every n frames and hold

  • blend random value every n frames and hold

    Posted by Pete Menich on July 6, 2022 at 2:29 pm

    I’, try to get a shape layer rectangle to change to a random size and hold, which the below does admirably….

    holdTime = .5; //time to hold each position (seconds)
    minVal = 100;
    maxVal = 1000;
    seed = Math.floor(time/holdTime);
    seedRandom(seed,true);
    x =random(minVal,maxVal);
    y = value[1];
    [x, y]

    However, I want it to blend between those values over ‘n’ frames, rather than jump from one value to the next.

    Anyone have any idea?

    thanks in advance!

    P

    Pete Menich replied 3 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    July 6, 2022 at 3:30 pm

    Try this:

    n = 5; //blend frames
    holdTime = .5; //time to hold each position (seconds)
    minVal = 100;
    maxVal = 1000;
    seed = Math.floor(time/holdTime);
    t = time%holdTime;
    seedRandom(seed,true);
    x2 =random(minVal,maxVal);
    seedRandom(seed-1,true);
    x1 =random(minVal,maxVal);
    x = linear(t,0,framesToTime(n),x1,x2);
    y = value[1];
    [x, y]
  • Pete Menich

    July 7, 2022 at 10:10 am

    Amazing as always Dan!

    (you’d think by now I’d know this stuff!)

    Thank you.

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