Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Create rows of random width bricks in predefined shapes to animate

  • Create rows of random width bricks in predefined shapes to animate

    Posted by Kunal Puri on May 31, 2010 at 6:47 am

    Hi. So here’s what I’ve been trying to do. The product art involves rows of bricks that form some fairly simple shapes like an icon of an ear or a shield or plus and minus signs. I need to animate these bricks building the shapes brick by brick. The easiest and most tedious (non-expression) thing to do would be to import the brick layers, apply a transform animation and sequence all the layers but I wonder if there’s a more sophisticated way of doing this.

    Is it possible, through expressions to start with a mask layer which the expression then fills in with stacked rows of random width bricks that can then be animated through a single controller layer. In an ideal world it should also be possible to alter the offset and overlap of the animation.

    I’m a dud at expressions and feel terribly daft for setting such a high bar for this project (impossibly high for me) so I do hope some of you kind folk at creative cow can throw me a rope. I just love the kind of control expressions bring to a project even if I’m a long way off from having any control, of my own, over expressions.

    Kunal Puri replied 15 years, 9 months ago 3 Members · 6 Replies
  • 6 Replies
  • Filip Vandueren

    May 31, 2010 at 7:48 pm

    That’s not really a task for expressions IMO.
    Think of an expression as a clever way to get a value for a property you would otherwise have to keyframe.

    You’re talking a lot of values for a lot of properties.
    This is more something a Particle system would be good at.

    Granted, you can write basic particle systems using expressions for position, rotation etc. Those would control 1 layer, and you would duplicate that layer a lot of times with random values to get a particlesystem.

    But dividing a layer into bricks is not something an expression can do. A script could do this, but I think we’re overcomplicating matters:

    May I suggets you take a look at the scatter plugin, it does an explosion into bricks, you could timereverse/timeremap a precomp of this effect. If you absolutelt need random layer bricks, you can design a custom scatter map

    Or perhaps the card-wipe / Card Dance plugin.

  • Kunal Puri

    June 1, 2010 at 3:55 am

    Thanks Filip. Your suggestions are well taken and it’s my mistake really. I didn’t explain the task very well. In fact I didn’t explain it correctly at all.

    The trouble with this project is that the bricks look a certain way (octagonal with curved edges) and the final formation is being adapted from a print job so I’ve actually already got this grid of bricks that form shapes, that now needs to be controlled in a dozen ways (all transform related).

    I initially thought I’d just create my own brick system using shapes, repeaters and alpha masks but then realised that the randomisation of the brick width would be a problem as well as the animation which would get cut off thanks to the alpha mask. In some cases I need the bricks to build the structure, sequentially, by falling from above. In some cases, by moving the bricks in Z space. Given this backdrop; Other than sequencing my layers is there some way of using expressions to sequence my animation and alter the overlap while also specifying the kind of animation through a control layer. I’m trying to put together the code but I’m being terribly slow about it. Will post it anon.

    All hail the cow!

  • Dan Ebberts

    June 1, 2010 at 4:22 am

    Maybe this will help. If you set your bricks up so that the anchor point is on the left edge, then you could give each brick in the row a position expression like this:

    if (index > 1){
    gap = 10;
    L = thisComp.layer(index-1);
    x = L.transform.position[0] + L.width*L.transform.scale[0]/100 + gap;
    [x, value[1]]
    }else{
    value
    }

    which will keep a fixed gap between the bricks as you scale them individually horizontally. Then you could use an expression to set each brick’s x scale from a random range and they should stay aligned with each other.

    I hope that gets you closer.

    Dan

  • Kunal Puri

    June 1, 2010 at 4:41 am

    Thanks Dan! That looks like it could get me a WHOLE LOT closer. I was far more verbose in my code and completely overlooked the if…else argument. Heading to my workstation, pronto.

    All hail the cow!

  • Filip Vandueren

    June 1, 2010 at 5:15 pm

    Could you post a screenshot of how these bricks are laid out ?
    because, if they are octogonal, how do the different rows fit into each other if they’re all of random width ?

  • Kunal Puri

    August 13, 2010 at 7:24 pm

    Hey Filip,

    I’m so sorry that this response comes weeks after the job was done but I’m sure you understand that the pressures we work with stay constant across the globe even if time-zones do a “Filip”. I haven’t put up a screenshot yet but just to explain, since the width is the only variable, the brick layering wasn’t a problem since the row height stays constant. The bricks were octagonal in that instead of a curved corner the bricks had angled corners. This does not get affected by the length of the brick since the corner angles and dimensions stay constant no matter what the length of the brick.

    Hope there’s a magic answer to this problem because I don’t see the end to jobs like these. I’ll try an put up a screenshot but by the time I get to work I invariably forget to do so. Just being as honest as I can and thanks ever so much for your feedback.

    What would I do without you guys!

    All hail the cow!

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