ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

sourceRectAtTime- 4 independent gaps

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
jano sempere
sourceRectAtTime- 4 independent gaps
on Apr 30, 2019 at 6:00:27 am

I've followed ECAbrams tutorial about sourceRectAtTime revisited



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


Return to posts index

Tomas Bumbulevičius
Re: sourceRectAtTime- 4 independent gaps
on Apr 30, 2019 at 6:40:29 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.


Return to posts index

jano sempere
Re: sourceRectAtTime- 4 independent gaps
on Apr 30, 2019 at 7:17:42 pm
Last Edited By jano sempere on Apr 30, 2019 at 7:19:45 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


Return to posts index


Tomas Bumbulevičius
Re: sourceRectAtTime- 4 independent gaps
on Apr 30, 2019 at 7:23:26 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.


Return to posts index

jano sempere
Re: sourceRectAtTime- 4 independent gaps
on May 3, 2019 at 2:55:20 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]