Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Adding noise/wiggle to a loading bar without it going backwards.

  • Adding noise/wiggle to a loading bar without it going backwards.

  • Evan Tillett

    April 8, 2021 at 3:52 pm

    I want to imitate an old mac loading bar. I have a linear wipe linked to a slider. I started with a time expression to go from 0-100, but I want the bar to occasionally jump ahead, inconsistently. Basically, I want a “wiggle” expression that only adds to the value of the slider and never decreases.

    Adding any sort of wiggle always causes it to jump backwards. I have tried many different methods and it still jumps. Is there any way to constantly add a random value each frame, the same way “time” adds 1 each frame, except a random amount added, without it jumping backwards.

    One method I was attempting, was using a “while loop” to continuously repeat the task of adding to n until it reaches 100, but there is no way to add delay to the while loop so it just executes immediately.

    I attempted the following expression to see if I could use “time” to increment the value so it would repeat until a number of seconds:

    i=0;
    n=0;
    while(i<10){
    i=time;
    n++;
    };
    n

    but this caused the expression to get disabled due to timeout.

    If there was a way to add a random value each frame, or delay a for/while loop to only execute each frame, then that would be perfect because I could make the added amount equal to a wiggle expression.

    Alternatively, if this would be easier with time remapping and I could randomize the speed of the slider, that could work too, but I would prefer to apply it at the slider level instead of precomping and time remapping.

    Any advanced expression people have any ideas?

    Thanks!

    Evan

  • Dan Ebberts

    April 8, 2021 at 11:36 pm

    This is not very efficient, but it might do what you want (or at least give you an idea):

    freq = 2;

    amp = 10;

    f = timeToFrames(time);

    accum = 0;

    for (i = 0; i <=f; i++){

    t = framesToTime(i);

    accum += Math.abs(wiggle(freq,amp,1,.5,t) - valueAtTime(t));

    }

    value + accum

Viewing 1 - 2 of 2 posts

Log in to reply.

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