Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects how to write an expression that increases incrementally

  • how to write an expression that increases incrementally

    Posted by Peter Stenhouse on October 9, 2006 at 1:11 pm

    I would like to write an expression that for every x number of frames (x being a random number) it increases by Y (y being a small increment like 0.1)
    I want to give the effect of timelapse film on an animation I have made by having the timeremap leap forward by a few extra frames every now and then. I have tried writing something with an If condition, but can’t get it to work. Wiggle doesn’t work either when applied directly to the timeremap attribute because the footage would go backwards, which is undesired.
    I would love some help
    Sincerely
    Peter

    Mark Allen replied 19 years, 7 months ago 3 Members · 2 Replies
  • 2 Replies
  • Mylenium

    October 9, 2006 at 6:41 pm

    You need to pack your stuff in a loop. My head is a bit munched, but something like this might be a start:

    min_frame=3; //minimum variation
    max_frame=12; //maximum variation
    real_frame=Math.round(random(min_frame,max_frame)); //get random frame range
    out_frame=0;
    count_frame=0;

    while (time < thisComp.duration) {out_frame=out_frame; out_frame += real_frame; count_frame++} else{nil} [framesToTime(out_frame)]

    Haven’t tested it and I’m terrible at loops, so maybe wait until Dan, Filip or yikesmikes have checked it. ;O)

    Mylenium

    [Pour Myl

  • Mark Allen

    October 9, 2006 at 7:06 pm

    I am far from an expert here, but I’m answering just in case the problem is urgent.

    I think that this might need to be a script, because expressions don’t hold their variables, for example:

    var x = transform.position[0];
    var y = transform.position[1];
    var z = transform.position[2];
    var increase = 0.1;
    if (random(100) > 50) y = transform.position[1]+increase;
    [x,y,z];

    Will randomly incrase the Y, but it will start back at 240 the very next frame.

    So – either you need to do this in a script or there is some clever way of assigning a value to a slider from within an expression that I don’t know about. I’m not swift enough that I could write the script, but perhaps someone will clue you further?

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