Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Offset range expression

  • Offset range expression

    Posted by Adam Zygadlo on April 18, 2013 at 1:11 pm

    Hello everyone,

    I am working on a project where I am building a pile of paper that stacks and animates up. The way I built the scene; I duplicated one layer and stack the 50 layers up in line like a skyscraper; then I offset the layers in the timeline to animate them building up.

    So far so good, however the pile of paper now looks to neat, straight and unrealistic. To solve it, I would like to offset the X space in the Anchor Point to make the pile more random by giving it a range of 50 pixels; either to the left or right and lock into place.

    Could someone help out and provide the expression for this?

    Cheers,
    +Z (Addz)

    Adam Jozef Zygadlo
    Motion Graphic Designer

    07708 124 915
    http://www.jarbrain.com
    ‘Filled with brainy goodness.’

    Adam Zygadlo replied 13 years, 4 months ago 2 Members · 4 Replies
  • 4 Replies
  • Adam Zygadlo

    April 19, 2013 at 10:01 am

    Okay, I had a little play this morning using other posts to understand some codes.
    I am very close to to the desire effect but it’s wiggling around… I just want it to lock/clamp in position.

    I know it’s the ‘slide = random(maxX,minX);’ line of code isn’t right but not sure how to write it up.

    Can anyone help?

    Cheers,
    +Z

    maxX = 40;
    minX = -40;
    offset = -257; // Resets the

    slide = random(maxX,minX);
    x = (slide-offset);

    [x,0]

    Adam Jozef Zygadlo
    Motion Graphic Designer

    07708 124 915
    http://www.jarbrain.com
    ‘Filled with brainy goodness.’

  • Adam Zygadlo

    April 19, 2013 at 11:50 am

    Okay, I’ve solved the wiggling issue and adjusted the code.

    Cheers,
    +Z

    maxX = 50; // Setup Max range
    minX = -50; // Setup MIn range
    offset = -359; // This is to cancel out the default position of the Anchor Point
    posterizeTime(1); // This stops the wiggling of the layer.

    slide = random(maxX,minX);
    x = (slide-offset);

    [x,0]

    Adam Jozef Zygadlo
    Motion Graphic Designer

    07708 124 915
    http://www.jarbrain.com
    ‘Filled with brainy goodness.’

  • Xavier Gomez

    April 19, 2013 at 12:03 pm

    Between the offset and slide lines add this:
    seedRandom(index,true)

    It takes a different random number for each layer, but doesnt take a new random number at every frame.

  • Adam Zygadlo

    April 19, 2013 at 1:59 pm

    If the project only needed one frame of the pile of paper, then my code would be ideal; however it changes position while scrubbing through the timeline. Nice effect but not desired! Oops!

    After looking around, I tweaked the code around and told it to hold on a couple of frames but your suggested code is cleaner. :^)

    Thank you Xavier for that!

    period = 1000; // frames
    posterizeTime(1/(period*thisComp.frameDuration));

    Adam Jozef Zygadlo
    Motion Graphic Designer

    07708 124 915
    http://www.jarbrain.com
    ‘Filled with brainy goodness.’

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