Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to offset this expression that wiggles a layer every 4 frames?

  • How to offset this expression that wiggles a layer every 4 frames?

    Posted by Yousuke Tadokoro on January 19, 2013 at 12:32 pm

    Hello. I modified Dan’s expression.
    https://forums.creativecow.net/thread/227/11235
    It wiggles a layer every 4 frames, but I want to change the starting point, I want to offset it.
    Right now the expression starts at 4 frame, but I want to make it start at 2 frame.
    So I want to wiggle a layer not on frame 4,8,12,16,20,,,,, but on frame 2,6,10,14,16,,,,,,, .
    Is it possible?

    And one more question. I want to reset the position that is modified by this expression on every 4 frames.
    I mean, on 2 frame, I want to wiggle the position,
    and on 4 frame I want to reset the position,
    and on 6 frame wiggle again , on 8 frame reset again, on 10 frame wiggle, on 12 reset,,,,,,, .
    In a word
    Wiggling position on frame 2,6,10,14,16,,,,,,,
    Resetting position on frame 4,8,12,16,20,,,,,

    I guess I need to use if else or add a “value ;” line, but I don’t know how to do.
    Give me your advice.Thank you in advance.

    period = 4; // frames
    posterizeTime(1/(period*thisComp.frameDuration));
    wiggle(10,500)

    Yousuke Tadokoro replied 13 years, 6 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    January 19, 2013 at 5:51 pm

    Try this:

    f = Math.floor(timeToFrames(time-inPoint)/2);
    f%2 ? wiggle(10,500,1,.5,framesToTime(f)) : value

    Dan

  • Yousuke Tadokoro

    January 19, 2013 at 6:44 pm

    Thank you Dan! It works.
    And one more question, can you change the post expression value of position X,Y to integral value?
    Right now value that your expression makes comes with floating point,it means my image is anti-aliased.
    I am animating aliased images so I don’t want to make anti-aliasing. Please give me your advice.

  • Dan Ebberts

    January 19, 2013 at 7:35 pm

    Try this:

    f = Math.floor(timeToFrames(time-inPoint)/2);
    p = f%2 ? wiggle(10,500,1,.5,framesToTime(f)) : value;
    [Math.round(p[0]),Math.round(p[1])]

    Dan

  • Yousuke Tadokoro

    January 19, 2013 at 11:15 pm

    Great.It works. Thank you for your advice.

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