Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Linking expression with a delay?

  • Linking expression with a delay?

    Posted by Richie Tovell on November 29, 2009 at 1:43 pm

    Is it possible to add a delay in to an expression that links two parameters?

    So for example, could you have 5 layers with their “y” rotations linked but a delay inserted between each layer so they rotate progressively later and later as the first “y” rotate control is adjusted, say 50 ms later the next layer follows then another 50 ms later the next and so on and so on?

    It would help me out of a tight spot, if anyone know’s the expression?

    Regards Richie.

    Coda – musical selections; in film, the ending or last section of a film (often wordless).

    Jake Hawley replied 16 years, 1 month ago 4 Members · 9 Replies
  • 9 Replies
  • Todd Kopriva

    November 29, 2009 at 2:51 pm

    The trick is to use the valueAtTime method.

    Dan has some examples and explanations on his site.

    There’s a simple example in After Effects Help:
    “Expression example: Create a trail of images”

    ———————————————————————————————————
    Todd Kopriva, Adobe Systems Incorporated
    putting the ‘T’ back in ‘RTFM’ : After Effects Help on the Web
    ———————————————————————————————————
    If a page of After Effects Help answers your question, please consider rating it. If you have a tip, technique, or link to share—or if there is something that you’d like to see added or improved—please leave a comment.

  • Dan Ebberts

    November 29, 2009 at 2:53 pm

    Something like this should do the trick:

    delay = .05;
    leader = thisComp.layer(1);
    leader.transform.rotation.valueAtTime(time – delay*(index-leader.index));

    Adjust the second line to use the index of your first layer (unless it’s already layer #1 in your layer stack).The expression assumes the follower layers are below the leader in the layer stack.

    Dan

  • Richie Tovell

    November 29, 2009 at 3:29 pm

    Ah, cool, thanks for the replies.

    Dan, my layers are stacked oddly, 15 layers are above the leader layer (though they can be moved perhaps). I was hoping to find an expression that can be applied separately to the individual layers that need to be delayed. Also, the delay needs to be applied to just the scale of each layer.

    Would that need a different expression? Here’s the expression I’m using, very simple.

    temp = transform.yRotation;[temp+100,100, temp+100]

    The layers don’t follow a precise pattern, they are all different sizes and rotate by different amounts, thus their scales need to increase at different times and by different amounts (this it to keep the overall image within the bounds of the comp, if the layers scale up at the wrong time they’ll leave the comp.

    In short I need to apply varying amounts of delay throughout 30 or so layers, the scale of these layers needs to increase by varying amounts after they have already begun to rotate.

    Could I do something like this?

    Change

    temp = transform.yRotation;[temp+100,100, temp+100]

    to?

    temp = transform.yRotation;[delay =.05;temp+100,100, delay =.05; temp+100]

    would that work, am I close?

    Coda – musical selections; in film, the ending or last section of a film (often wordless).

  • Richie Tovell

    November 29, 2009 at 4:01 pm

    No I think I’m doing this the wrong way completly, time is too confusing as there’s the time it takes to rotate and also the time in the actual comp.

    Could I do this instead,

    here’s the linked expression temp = transform.yRotation;
    [temp, temp, temp]

    Can I set this expression to only act only after the layer has rotated by a certain degree, so after 50 degrees y rotation the temp values start to increase?

    Coda – musical selections; in film, the ending or last section of a film (often wordless).

  • Richie Tovell

    November 29, 2009 at 5:38 pm

    This was what I figured out. Sorry I wasn’t very clear before.

    temp = transform.yRotation;

    if (temp <50){

    [100, 100, 100];

    }else{temp = transform.yRotation;
    [temp+50, 100, temp+50]; }

    Coda - musical selections; in film, the ending or last section of a film (often wordless).

  • Dan Ebberts

    November 29, 2009 at 7:55 pm

    OK – I’m lost. Is each layer’s scale controlled by its own rotation, the rotation of another layer, or ???

    Is there a direct relationship between the angle of rotation and the percent increase or decrease in the scale? For example, if the layer’s scale starts out at {[100,100]) and the controling angle is rotated to -7 degrees, you want the scale to end up at [93,93] after some delay, is that correct?

    What controls the amount of delay for each layer, something that you’re going to define in each layer’s expression?

    Dan

  • Richie Tovell

    November 30, 2009 at 12:49 am

    Sorry for confusing you Dave, I love working with expressions but I’m not so good at it.

    I’ve sussed out what I need to do but you could definitely do a better job, maybe there is no better way though, the pics bellow should make thing clearer.

    So, the image is split in to 12 or so layers, these are all parented together, their anchor point’s placed side by side.

    They collapse when the lead layer’s y rotation is adjusted, all the y rotations are linked to this lead layers y rotation by varying degrees so they will rotate by different amounts to form the final collapsed shape that you see, the x and z scales for each layer are also all linked to the lead layers y rotation, this is so that the whole shape can be collapsed from one transform control, that control (the y rotation on the lead layer) is linked to the output of trapcode sound keys that way the image will follow audio as it collapses.

    I’m now experimenting with leaving the scale off of some of the layers and adding more scale to others to create more of a distortion on the layers surface, it’s looking good so far and a few instances of 3d layer warps will be added to the front facing layers to distort them even more as, in itself it’s a pretty boring shape, it needs a lot of improving.

    In addition to this all the y rotations roatate by different amounts and so to do the scales increase at different amounts, this is why I needed an expression that I could apply and easilly adjust for each layer individually.

    The problem was that as the image started to collapse the scale increase forced the image off of the sides of the screen, so I was thinking along the lines of delaying the scaling till after the collapse had started that way the scale would push the rotated layers more in the z plain rather than sideways out of the comp.

    Sorry it’s not that great an idea, but complicated to explain and still needs a lot of work, the nice thing about it is it’s independent of the timeline until it’s linked to the tracode audio layers, which means I can swap out the audio and distort the image using different sounds as the comp develops.

    Hope that’s made things clearer?

    Coda – musical selections; in film, the ending or last section of a film (often wordless).

  • Richie Tovell

    November 30, 2009 at 1:03 am

    Oh, I forgot, there’s more than 12 layers there, the layers are doubled up, so there’s actually closer to 30, the reason for this is that the aliasing left lines along the folds so each layer has a copy of it’self placed below it with it’s quality set to draft, this fills in the lines but keeps the top layer at best quality, I just thought I’d mention it because I originally said there were 30 layers which in fact there are.

    I’d love to be able to find a plugin that could do this, but their doesn’t seem to be one lol.

    Thanks though and sorry for being so confusing.

    Coda – musical selections; in film, the ending or last section of a film (often wordless).

  • Jake Hawley

    March 22, 2010 at 9:22 pm

    I used a variation of this script to delay a mask that was fading up. the opacity of the layer was pick wicked to the ‘end’ property of the stroke effect. however the change came into have the mask fade in after the object was drawn on.

    this is a sample of what i used.

    didn’t set up variables because it just seemed like extra typing, even though its pretty messy.

    Thanks!

    delay = .05;
    thisComp.layer("Layer 6 copy 3").effect("Stroke")("End").valueAtTime(time - delay*(index-thisComp.layer("Layer 6 copy 3").index));

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