Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression to attach shape layers together combine with “sourceRectAtTime()”

  • Expression to attach shape layers together combine with “sourceRectAtTime()”

    Posted by Max Souliers on September 26, 2024 at 9:08 pm

    Hello everybody! I think I tried my best before asking you some help! I’m turning crazy!

    I have this kind of animation:

    3 text layers with 3 corresponding shape layers behind.

    I need the shape layers to dynamically fit my text layers with a “sourceRectAtTime()” expression.

    But also, I need my first shape layer to have its bottom left corner attached to the top left corner of the shape layer 2 AND the top right corner of the shaper layer 3 attached to the bottom right corner of the shape layer 2.

    Then, As soon I change the second text (flush centered), the first text (flush left) AND the third text (flush right) follow..

     

    THANK YOU VERY MUCH in advance!

    Brie Clayton
    replied 2 weeks, 2 days ago
    3 Members · 6 Replies
  • 6 Replies
  • Andrei Popa

    September 27, 2024 at 11:02 am

    Hi Max,

    There are quite a few expressions to be used there.
    I have done a small template for this, I hope this helps.

    r2 is the parent for all the rectangles and its text;

    all the texts are parented to their rectangles

    all the texts have anchor expression to their center

    all the texts must be one index smaller in timeline. You can’t put any layers between them because they are referred by “index-1” when calculating the rectangle sizes.

    all the rectangles have a point control effect on them, named “Diff”, which dictates how much bigger than the text sourceRect they are

    Let me know if you have any questions.

    Cheers,

    Andrei

  • Max Souliers

    September 27, 2024 at 12:02 pm

    Waw Andrei! This is exactly what I was looking for. It looks easy for you! Impressive! I can’t say how you helped me! THANK YOU SO MUCH!!!

  • Max Souliers

    September 27, 2024 at 12:17 pm

    I take advantage of your skills to ask you something else…I’m french and I’m working with a french version of After Effects so some effects are renamed (Adobe sucks sometimes…) so I updated your expressions to make it works in my french version.

    But I will send this document to english people who’ll use the english version…Do you know how to make it compatible in every language version of the software?

    You’ll tell me, use my original expression…I know but I will add other things like color variations etc…

    THANK YOUUUU!!!

  • Max Souliers

    September 27, 2024 at 12:30 pm

    After experimenting your file…I have a last question! (sorry, I’m so excited that I answered too fast).

    Concerning the “r2” shape. Because its anchor point is on its top left, when I modify the x Point of the Diff of this layer, the shape is expanding from this anchor point. Or, I’d like to be “centered” and expanding from the middle of the shape.

    I hope I explained it correctly. THANK YOU! Again, sorry for these multiple answers.

  • Max Souliers

    September 27, 2024 at 2:46 pm

    Ok so I used the Plugin “Expression Universalizer 4” to make my expressions universal.

    I corrected the position on the X axis of the “r2” shape layer by adding this to the xPosition: “

    compWidth = thisComp.width;

    shapeWidth = thisLayer.sourceRectAtTime(time, false).width;

    centerX = (compWidth – shapeWidth) / 2;

    centerX;”


    And Now, everything is PERFECT!!!


    THANK YOU SO MUCH for your help!

  • Brie Clayton

    September 27, 2024 at 10:36 pm

    Thank you, Andrei, for this solve!

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