Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions progressive acceleration with memory

  • progressive acceleration with memory

    Posted by Micheel Leavitt on September 8, 2009 at 7:06 am

    So I have this piece of code for rotation:

    amp = 180;
    data = thisComp.layer(“Null 2”).effect(“Range 2”)(“Slider”);
    inc = ease(data,7,20,0,25);
    j = 0;
    accum = 0;
    while(data>=7){
    accum += inc;
    }
    time*amp+accum

    and the idea was that it could remember the last frame’s rotation value but accumulate more and more so that it would never go backwards, if you can see what I mean. The problem is I can’t even see whats going on because it timeouts the engine every time “data” hits 7. I’m guessing this has to do with a memory issue, and perhaps a problem with the code too, but I’m not really sure. This is being applied to the rotation and evolution of Fractal Noise, and I am working on a dualcore 2Ghz with about 1.5 gigs of memory for AE to hog. If the interpolation won’t be possible to calculate a progressive acceleration, is there another way? Thanks in advance for any help!

    Micheel Leavitt replied 16 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    September 8, 2009 at 12:44 pm

    If your while loop ever triggers (i.e. data is greater than or equal to 7) the loop will never end, because the value of data will not change.

    If you’re trying to accumulate values across time, you need to use valueAtTime() to get them, otherwise the expression only looks at values for the current frame.

    Dan

  • Micheel Leavitt

    September 8, 2009 at 6:43 pm

    I found a post from a while back that was very similar to my problem, and I was able to figure it out:

    fd=thisComp.frameDuration;
    t=0;
    x=0;
    amp = 30;
    while (time>t) {
    accel = thisComp.layer(“Null 2”).effect(“Range 1”)(“Slider”).valueAtTime(t);
    x+=accel*fd;
    t+=fd;
    }
    value + amp*x;

    I see what you mean by the needing to use the valueAtTime() to get the value, it has to be told what frame it needs to take the value from, which is one frame behind the calculation, right? This does what I was looking for, and I realized the linear() was freaking AE out when it was a part of the while() loop. Is it too much for it to handle? I am curious. Thank you Dan and Filip for the help!

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