Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions sourceRectAtTime- 4 independent gaps

  • sourceRectAtTime- 4 independent gaps

    Posted by Jano Sempere on April 30, 2019 at 6:00 am

    I’ve followed ECAbrams tutorial about sourceRectAtTime revisited https://youtu.be/In4miXUdxko and everyting works perfect, great tutorial.
    But, I need to control gap independently not just fot the x and y, need more control, but can’t find the way.

    Code for size box

    var s=thisComp.layer("texto");
    var w=s.sourceRectAtTime().width;
    var h= s.sourceRectAtTime().height;
    var mv=thisComp.layer("texto").effect("Margen H")("Deslizador");
    var mh=thisComp.layer("texto").effect("Margen V")("Deslizador");

    [w+mv,h+mh];

    Code for position box

    var s=thisComp.layer("texto");
    var w=s.sourceRectAtTime().width/2;
    var h= s.sourceRectAtTime().height/2;
    var l= s.sourceRectAtTime().left;
    var t= s.sourceRectAtTime().top;

    [w+l,h+t];

    It centers always.

    Hope find solution,
    Thanks,

    Motiongrapher at cinestorm.es

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

    Jano Sempere replied 7 years ago 2 Members · 4 Replies
  • 4 Replies
  • Tomas Bumbulevičius

    April 30, 2019 at 6:40 pm

    Hey Jano,

    do you want to keep the texts in the same place, while maintaining paddings, but to change width of the gap?

    A) You could add matte where it should be, subtract it from the whole comp and then grow from the center of its position.
    B) You could set anchor point expression of left object box to be on the left, and for the right one – on the right. Then each boxes width will grow from left/right and you could change each of them individually.

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.

  • Jano Sempere

    April 30, 2019 at 7:17 pm

    [Tomas Bumbulevičius] “ange eac”
    B) You could set anchor point expression of left object box to be on the left, and for the right one – on the right. Then each boxes width will grow from left/right and you could change each of them individually.

    Thanks tomas,
    I don’t mid about the global gap,
    I’ve tried Option B, but i didn’t find the expressions to work correctly, it grows weird.
    My hopes goes on doing just one template allowed to modify depending on the needs of position and length.

    I’ll keep working, will post if I find solution.
    Thanks

    Motiongrapher at cinestorm.es

  • Tomas Bumbulevičius

    April 30, 2019 at 7:23 pm

    Try to do the following for the text-boxes anchor points (assuming they are both separate layers).

    Left one:
    sourceSize = thisLayer.sourceRectAtTime(time, false);
    T = sourceSize.top;
    L = sourceSize.left;
    W = sourceSize.width;
    H = sourceSize.height;
    ([L+ 0,T+H/2])

    Right one:
    sourceSize = thisLayer.sourceRectAtTime(time, false);
    T = sourceSize.top;
    L = sourceSize.left;
    W = sourceSize.width;
    H = sourceSize.height;
    ([L+ W,T+H/2])

    You could use your used expressions with the same wording – just pasted here what I use. Most likely you will need to adjust position as well, but this will give you an idea how to make an object sticky!

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.

  • Jano Sempere

    May 3, 2019 at 2:55 pm

    Thanks Thomas, you are a hero,

    It works perfect, I can adjust position to stick it ok and old expressions still works.

    And both boxes are separate layers, thanks for assuming it.

    With one slider I can control X gap and Anchor point expression keeps box in hte right way.

    Thanks.

    Motiongrapher at cinestorm.es

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