Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Apply “posterizeTime()” on only one part of an expression

  • Apply “posterizeTime()” on only one part of an expression

    Posted by Remi Monedi on November 15, 2018 at 9:57 am

    Hi everyone, here again with probably an impossible question :

    I combined 2 expressions (loopOut and wiggle) and I’d like to apply the expression “posterizeTime()” only to the wiggle expression (this is an example).
    Is it possible? My tests with “posterizeTime()” ended with everything AFTER it being temporally posterized. So I was wondering if somehow it could be limited to only one expression (within a variable maybe?).

    Have a nice day!

    Remi Monedi replied 7 years, 5 months ago 4 Members · 6 Replies
  • 6 Replies
  • Kalleheikki Kannisto

    November 15, 2018 at 2:35 pm

    Any value can be “posterized” using the Math.floor expression. The exact method depends on what you’re doing. Most likely the valueAtTime() is involved. For example, to posterize something to happen 5 times per second in a 25 fps comp, this works for many properties:

    valueAtTime(Math.floor(time*5)/5)

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Remi Monedi

    November 15, 2018 at 3:14 pm

    Thank you Kalleheikki! I did find this trick too but the “posterizeTime()” expression is just simpler this is why I was wondering if it was possible to apply it only on one part of an expression?

  • Alex Printz

    November 15, 2018 at 4:38 pm

    yeah, all you have to do is declare the posterizeTime between the different calculations, and then recombine. This will wiggle the X position at comp framerate, and this will wiggle the Y at 1 per second:

    X = wiggle(2,50);
    posterizeTime(1);
    Y = wiggle(2,50);
    [X[0],Y[1]]

    Alex Printz
    Mograph Designer

  • Remi Monedi

    November 16, 2018 at 3:36 am

    Thank you Alex but what if I want to apply a different “posterizeTime()” to each wiggle (like in your example)?
    This won’t work obviously, the first “posterizeTime()” influencing the second :

    posterizeTime(3);
    X = wiggle(3,500);
    posterizeTime(30);
    Y = wiggle(3,500);
    [X[0],Y[1]]

  • Dan Ebberts

    November 16, 2018 at 4:31 am

    You could do something like this:

    p = 1/3;
    t = p*Math.floor(time/p);
    x = wiggle(3,500,1,0.5,t)[0];
    p = 1/30;
    t = p*Math.floor(time/p);
    y = wiggle(3,500,1,0.5,t)[1];
    [x,y]

    Dan

  • Remi Monedi

    November 16, 2018 at 4:55 am

    Thank you Dan, I guess I have my answer :

    It’s not possible to apply several “posterizeTime()” to different part of an expression without the first one bypassing the others.

    I did find an old answer from you Dan (2012) with more or less the same code you wrote here 😉

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