Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions timeout on first frame of while loop

  • timeout on first frame of while loop

    Posted by Micheel Leavitt on December 14, 2009 at 1:26 am

    This is odd.

    t =time%Math.PI;
    x = 0;
    while(t<.05){ x++ } x this is applied to a null with no animation whatsoever, I just checked to see if this would work and it keeps saying there is a timeout while waiting for the engine. T only goes as high .04 on the target frame (xPI seconds)and then it is always higher than this, so I figured this would work. Anyone know why AE is giving me a hard time?

    Micheel Leavitt replied 16 years, 5 months ago 3 Members · 7 Replies
  • 7 Replies
  • Todd Kopriva

    December 14, 2009 at 2:18 am

    On the first frame, t is less than 0.05. You have a while loop that is going to run _on that one frame_ until it completes… which is never because the condition of t < .05 is always true on that frame. --------------------------------------------------------------------------------------------------------- Todd Kopriva, Adobe Systems Incorporated putting the 'T' back in 'RTFM' : After Effects Help on the Web
    ———————————————————————————————————
    If a page of After Effects Help answers your question, please consider rating it. If you have a tip, technique, or link to share—or if there is something that you’d like to see added or improved—please leave a comment.

  • Micheel Leavitt

    December 14, 2009 at 11:37 pm

    So I should include a condition that omits t==0? I tried that by rewriting it:

    while(t<.05&&t!=0) but it would still timeout 🙁 I figured time/PI at time=0 would equal 0 right? So maybe I'm setting this up wrong? Thanks for the help so far Todd!

  • Todd Kopriva

    December 14, 2009 at 11:49 pm

    I think that you’re missing the point that the while loop is running on just one frame. All expressions run to completion on just one frame. They do not span frames. The value of t (time) is not going to change at any point during your while loop.

    ———————————————————————————————————
    Todd Kopriva, Adobe Systems Incorporated
    putting the ‘T’ back in ‘RTFM’ : After Effects Help on the Web
    ———————————————————————————————————
    If a page of After Effects Help answers your question, please consider rating it. If you have a tip, technique, or link to share—or if there is something that you’d like to see added or improved—please leave a comment.

  • Dan Ebberts

    December 15, 2009 at 12:41 am

    What, exactly, are you trying to do?

    Dan

  • Micheel Leavitt

    December 15, 2009 at 1:03 am

    well, it kinda goes like this….

    I set up a formula (on paper) that scales out an object following a fibonacci pattern, and the recursion counts up every approx. PI seconds. The margin of error was about .05 on the frame desired, so I thought maybe the while loop would work to set up the recursion. I thought maybe the modulus time%Math.PI would be fine because it does change every frame, but I guess I’m wrong somewhere 🙁 Basically I have the formula all set up I just need a counter that will count up one every PI seconds x.x

    I also figured out a formula to interpolate the values between each set of recursion, I just need the damn counter to test it. Thank you Todd for the help, I still don’t see why the modulus time%Math.PI won’t change, but then again my knowledge of loops is next to nil. Ah well.

  • Dan Ebberts

    December 15, 2009 at 1:16 am

    How about this:

    Math.floor(time/Math.PI)

    Dan

  • Micheel Leavitt

    December 15, 2009 at 3:50 am

    Sry for not responding earlier, this works like a charm. I changed it to happen every approx. 1.62 seconds,and when I interpolated it it kind of came out weird. Heres how I did it

    phi = (1+Math.sqrt(5))/2;
    count = Math.floor(time/phi);
    x = count*phi;
    x1 = (count+1)*phi;
    y = thisComp.layer(“Null 1”).effect(“fib”)(“Slider”).valueAtTime(x);
    y1 = thisComp.layer(“Null 1”).effect(“fib”)(“Slider”).valueAtTime(x1);
    x = linear(time,x,x1,y,y1);
    [x,x]

    What is wrong with this? It does indeed interpolate, but it waits a little too long to begin interpolating the next values. BTW this is on the scale of an object. the effect “fib” is this:

    s = Math.sqrt(5);
    phi =(1+s)/2;
    count =Math.floor(time/phi);
    nphi = (1-s)/2;
    x = Math.pow(phi,count);
    y = Math.pow(nphi,count);
    (x-y)/s

    which works perfectly as far as I have seen, which is to this 100th recursion. So can anyone see why is the interpolation not properly following the values given to it? Thanks for any help!

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