Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Offset Position AND TIME expression

  • Offset Position AND TIME expression

    Posted by Jennifer Arani on September 11, 2012 at 11:22 pm

    Hello Everyone,
    I am trying to create an expression that will help me animate 15 pages of a pdf. I have the keyframe set for page 1.
    I want the other pages to fall in but moved over a hair on both x and y and their movement spaced out as well.

    So I found a thread that KINDA helps, but it only solves 1/2 my problem:
    https://forums.creativecow.net/readpost/2/875415

    And I have a script ALOT like it:
    offset = -.5;
    p = thisComp.layer(“Page 1/ProtectorPlus.psd”);
    t = time + offset;
    p.position.valueAtTime(t);

    So – For TIME this is GREAT works like a charm. For position offset, no so much!
    I have some code I made up with my whole 6 hours of expression experience, so only laugh a little at how bad it is. This works for the spacing but not the time:

    offset = index – 1;
    xNum = thisComp.layer(“Page 1/ProtectorPlus.psd”).position[0];
    yNum = thisComp.layer(“Page 1/ProtectorPlus.psd”).position[1];
    zNum = thisComp.layer(“Page 1/ProtectorPlus.psd”).position[2];
    x = xNum – offset+100;
    y = yNum – offset+50;
    z = zNum;
    [x,y,z]

    How the Heck do I COMBINE the first code and the second?! So my papers space correctly over time?

    thanks
    Jennifer

    Jennifer Arani

    Kevin Camp replied 13 years, 11 months ago 3 Members · 3 Replies
  • 3 Replies
  • Cassius Marques

    September 12, 2012 at 1:17 pm

    I suck at expressions, but I’ll try to help.

    First you have two different values for the variable offset…You’ll need to rename one.
    Since your first expression already instances your posisiton you won’t need to do it again on the second one… so i’m gessing you’ll just need to give it the position offset you want.

    Try something like

    offset = -.5;
    p = thisComp.layer(“Page 1/ProtectorPlus.psd”);
    t = time + offset;
    r = p.position.valueAtTime(t);
    noffset = index – 1;
    [r[0] – noffset+100, r[1] – noffset+50, r[2]]

    Give me some feedback of what you got.

  • Cassius Marques

    September 12, 2012 at 1:26 pm

    Thinking about it, this will probably work only for the first layer (page 2)…but I’ll wait for you to check it out.

  • Kevin Camp

    September 13, 2012 at 3:07 pm

    if cassius’s expression did not work, i think this is what you are looking for:

    Delay = .5; // value in seconds
    Offset = [100,50,0]; // offset position array [x,y,z]
    PreviousLayer = thisComp.layer(index-1); // this looks at the layer right above it
    PreviousLayer.position.valueAtTime(time – Delay) + Offset; // this puts it all together

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

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