ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Value changes a few frames before it's supposed to

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
David Cabestany
Value changes a few frames before it's supposed to
on Aug 14, 2019 at 9:01:34 pm

I'm using a text layer to drive the size of a background box using sourceRectAtTime.
The text is driven by an expression that updates the value using the comment inside the markers, much like using hold keyframes but I do not need to drag them.

The box adjusts its size to the corresponding dimensions three frames before the marker is reached. I do not understand why. Can anyone help me understand?

Thanks.

Expresion for the text layer:

txt = value;
n = 0;
if (thisComp.marker.numKeys > 0){n = thisComp.marker.nearestKey(time).index;
if (thisComp.marker.key(n).time > time) n--;
if (n > 0) txt = thisComp.marker.key(n).comment;
}
txt;
-----------
Expression for the scale of the box:

t = thisComp.layer("xp").effect("Layer Control")("Layer");
margin = thisComp.layer("xp").effect("margin")("Slider");
r = t.sourceRectAtTime(time-t.inPoint,false);
w = r.width*t.scale[0]/100 + margin;
h = r.height*t.scale[1]/100 + margin/2;
[w/width,h/height]*100


Return to posts index

Dan Ebberts
Re: Value changes a few frames before it's supposed to
on Aug 14, 2019 at 9:21:44 pm

Hard to say without seeing it, but I'd check this:

t.sourceRectAtTime(time-t.inPoint,false);

Why do you have t.inPoint in there?

Dan



Return to posts index

David Cabestany
Re: Value changes a few frames before it's supposed to
on Aug 14, 2019 at 9:26:32 pm

Hey Dan,

The text layer does not start at the beginning of the composition, I added that so the layer didn't start showing at the very first frame.
I just removed it to test and the problem worsens, now the size increases to the second value the moment it hits the first marker.

I can send you the file if you don't mind looking at it.

Thanks,


Return to posts index


David Cabestany
Re: Value changes a few frames before it's supposed to
on Aug 14, 2019 at 9:35:22 pm

I managed to solve it by adding .1 to the inPoint, but I can't understand why.
If you can explain why is happening it's be greatly appreciated.

t = thisComp.layer("xp").effect("Layer Control")("Layer");
margin = thisComp.layer("xp").effect("margin")("Slider");
r = t.sourceRectAtTime(time-(t.inPoint+.1),false);
w = r.width*t.scale[0]/100 + margin;
h = r.height*t.scale[1]/100 + margin/2;
[w/width,h/height]*100


Return to posts index

Dan Ebberts
Re: Value changes a few frames before it's supposed to
on Aug 14, 2019 at 9:48:09 pm

I'd have to see it, but you probably just need to compensate for have the text layer's startTime not at time = 0.

Dan



Return to posts index

David Cabestany
Re: Value changes a few frames before it's supposed to
on Aug 15, 2019 at 1:11:44 pm

I think is that too, but can't understand why the frames since the layer begins several more frames after.

Can I send you the file? I have your email already.


Return to posts index


Dan Ebberts
Re: Value changes a few frames before it's supposed to
on Aug 15, 2019 at 1:39:32 pm

Sure.

Dan



Return to posts index

David Cabestany
Re: Value changes a few frames before it's supposed to
on Aug 30, 2019 at 4:04:13 pm

I think this expression (sourceReactAtTime) is either broken or not quite ready to be included with AE.
I'm getting all sorts of unwanted jumps and resizes even after I compensated for the in point of the layer. It's been more of a hindrance than a helper.

Reporting a bug to adobe, once an easy task, it's now useless with their new "forum" format.


Return to posts index

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