ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

sourceRectAtTime() update when keyframing the text source ?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Matthieu Foulet
sourceRectAtTime() update when keyframing the text source ?
on Mar 31, 2017 at 1:42:48 pm
Last Edited By Matthieu Foulet on Mar 31, 2017 at 2:16:57 pm

Hi everyone,
I am using the sourceRectAtTime() expression to create a box around a text layer like this :

par=thisComp.layer("TEXT");
rect = par.sourceRectAtTime(time,false);
padding=thisComp.layer("Control Text").effect("Padding")("Curseur");
w = rect.width+padding;
h = rect.height+padding;
[w,h]


This works very well but I have no idea wether it's possible to update the sourceRectAtTime() expression when I keyframe the source text of my layer.

If anyone could point me to the right way of doing it (if it's even possible), that would make my day !

EDIT : I tried searching for the expression language reference on Adobe website but the sourceRectAtTime() expression is not listed...


Return to posts index

Dan Ebberts
Re: sourceRectAtTime() update when keyframing the text source ?
on Mar 31, 2017 at 3:43:47 pm

It should work. Did you try it?

Dan



Return to posts index

Kevin Camp
Re: sourceRectAtTime() update when keyframing the text source ?
on Mar 31, 2017 at 3:43:56 pm

it should update as the source text changes.

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index


Matthieu Foulet
Re: sourceRectAtTime() update when keyframing the text source ?
on Mar 31, 2017 at 4:02:28 pm

I deleted my layers and restarted from scratch, put back the expression and it worked as expected on any kind of layers.

There must have been something wrong with my previous text layer, for which I copy/pasted the content from one comp to another.
I don't understand what but it's now working.

Thank you Dan and Kevin for your answers.

Windows 10 64bits
intel i7-5930K@3.50Ghz
32Go DDR4 RAM
GPU AMD Firepro W7100 8Go


Return to posts index

Adam Goddard
Re: sourceRectAtTime() update when keyframing the text source ?
on Apr 24, 2017 at 8:01:10 am

Hi
Would you please advise steps on how you used this expression with text layer. Much appreciated.


Return to posts index

Matthieu Foulet
Re: sourceRectAtTime() update when keyframing the text source ?
on Apr 24, 2017 at 12:41:34 pm

Sure,
At first, I typed my text into a comp.
I then created a rectangle shape on a new shape layer, wich I parented to my text layer so that if will follow the text layer if I moved it within the comp.
I then insert the following expression into the rectangle size option of the shape layer :


par=thisLayer.parent;
rect = par.sourceRectAtTime(time,false);
w = rect.width;
h = rect.height;
[w,h]


Finally, I adjusted the anchor point of the shape with an expression to match the anchor point of the text.

Hope it helps, here is an AE CC file with a text and a shape, that includes some padding around the text, too.

11291_textboxcreativecow.aep.zip

Windows 10 64bits
intel i7-5930K@3.50Ghz
32Go DDR4 RAM
GPU AMD Firepro W7100 8Go


Return to posts index


Adam Goddard
Re: sourceRectAtTime() update when keyframing the text source ?
on Apr 28, 2017 at 10:03:54 am

Hi
Thanks for your reply, apologies for my slow reply.


Return to posts index

Adam Goddard
Re: sourceRectAtTime() update when keyframing the text source ?
on Jun 26, 2017 at 11:55:12 pm

Hi Matthieu
thank you so much for sharing your comp with sourceRectAtTime(). Unfortunately, I'm stuck with working out why the 2 expression errors alert for 'Curseur' appear - please see screenshots. if you could let em know that would be great, thank you.



Return to posts index

Matthieu Foulet
Re: sourceRectAtTime() update when keyframing the text source ?
on Jun 27, 2017 at 6:08:54 am

Sûre!
i forgot to tell you that I am working with a French version of After Effects.
You need to adapt the expression in English.
To do that, you have to edit the expressions and change every time you encounter "Curseur" with "Slider", and everything should be fine.

Windows 10 64bits
intel i7-5930K@3.50Ghz
32Go DDR4 RAM
GPU AMD Firepro W7100 8Go


Return to posts index

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