Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Beginner’s AE-expression problem

  • Beginner’s AE-expression problem

    Posted by Ilkka Pitkänen on February 5, 2012 at 5:52 pm

    Hi,

    I’m completely unfamiliar with expression and I’m looking for a solution to my most likely very simple problem. I’m trying to create a composition in which there is X amount of layers and I would like to create an expression to control the opacity of each layer every frame.

    So I’d like to have a 24fps comp where I first play 1 frame from the first layer, then 1 frame fro the second layer, 1 frame from the 3rd layer etc. UNTIL I reach the final layer of the composition after which I would like to go back to to the first layer and start over again ( layer 1,2,3… then layer 1,2,3… etc)

    So far I have created a Null object (named Control) and added this expression to the Slider control

    xxx= Math.abs(Math.round(1))+1+(time*24);
    if (xxx> (thisComp.numLayers-1)) *????????????????????* else xxx


    And the following expression to the Opacity of all other layers:


    if (thisComp.layer(“Control”).effect(“Slider Control”)(1) == index) 100 else 0

    So basically I’m asking with what I should replace “*????????????????????*” or is this even a sensible way to achieve what I’m trying to do?

    Ilkka Pitkänen replied 14 years, 2 months ago 3 Members · 5 Replies
  • 5 Replies
  • John Madison

    February 6, 2012 at 3:01 pm

    I am not sure what you are after, but there may be a solution without using expressions. Why dont you pre-compose your layers and make the composition duration 1 frame. Then add all these pre-comps to your main comp and then select all > keyframe assistant > sequence layers.

    This will distribute the layers across your main comp one frame at a time.

  • Ilkka Pitkänen

    February 6, 2012 at 4:22 pm

    Thank you for your reply, but that’s not what I’m really looking for…

    I am looking for a way to play sequentially one frame of each layer from continuous video footage.

    So I have, let’s say, four layers of video footage, of which I want to play first frame from the first layer, second frame from the second layer, third layer from the third layer and fourth layer from the fourth layer. And then return back to the first layer and start over again.

    And I need it the expression to be flexible for different amount of layers.

    Editing four layers together this way without expressions or some other trick is pretty tedious…

    I found an expression how to do this randomly, but I need to have control over the order of frames played.

    Here is the expression I used as my base:

    https://forums.creativecow.net/thread/2/986190

  • Ilkka Pitkänen

    February 8, 2012 at 4:38 pm

    Maybe if I’ll make it simpler, someone could help me with the problem:

    So if I have four layers, in the end I need to the Slider effect to have different value every frame with values 2,3,4,5 sequentially (2,3,4,5,2,3,4,5,2,3,4,5,2,3,4,5….).

    Of course I can just a lot of copy/paste keyframes, but I’m looking for expression to make it more flexible (with different amount of layers etc.)

    All help very much appreciated!

  • Dan Ebberts

    February 8, 2012 at 5:19 pm

    This should work:

    n = 4;
    timeToFrames(time)%n + 2

    Dan

  • Ilkka Pitkänen

    February 8, 2012 at 5:35 pm

    Rock’n’roll!

    Thank you so much Dan!

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