• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

controlling 4 keyframes with sourcerectattime

Participant ,
Oct 12, 2022 Oct 12, 2022

Copy link to clipboard

Copied

Hi, I am trying to solve a problem. I have used a manual workaround for this issue for a long time, but Id like to solve it properly once and for all.

I have included a reduced version of the project. Basically I have 6 key frames, the 1<sup>st</sup> and 6<sup>th</sup> are off screen and should always be fixed positions. The 2<sup>nd</sup> key frame is the end of the opening animation which I would like to be controlled by the sourcerectatime property of my text, which I have done successfully in other scenerios. There is a blue guide showing where the text needs to end.

This position is also for the 3rd keyframe.

Now for the 4th keyframe, I have another position to consider, there is a second text that comes in now, and this new position should be controlled by that 2nd text’s sourrectattime property for keyframes 4 and 5. I have included a project that have manual keyframes, but is there a way to change these values to be driven by the text while respecting the animation curve of the position ?

 

Thanks for any help.

TOPICS
Expressions , How to

Views

343

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 12, 2022 Oct 12, 2022

Copy link to clipboard

Copied

edit -

Hi, I am trying to solve a problem. I have used a manual workaround for this issue for a long time, but Id like to solve it properly once and for all.

I have included a reduced version of the project. Basically I have 6 key frames, the 1st and 6th are off screen and should always be fixed positions. The 2nd key frame is the end of the opening animation which I would like to be controlled by the sourcerectatime property of my text, which I have done successfully in other scenerios. There is a blue guide showing where the text needs to end.

This position is also for the 3rd keyframe.

Now for the 4th keyframe, I have another position to consider, there is a second text that comes in now, and this new position should be controlled by that 2nd text’s sourrectattime property for keyframes 4 and 5. I have included a project that have manual keyframes, but is there a way to change these values to be driven by the text while respecting the animation curve of the position ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 12, 2022 Oct 12, 2022

Copy link to clipboard

Copied

It would be more useful to actually include screenshots and such. People aren't always at their computer or won't/ can't download projects for various reasons. That said, what you want is perfectly possible. The missing part is just a linear(time, key(3).time,key(4).time, valueAtTime(key(3).time), valueAtTime(key(4).time)) or something similar. On my tablet now, but if Dan Egbert's doesn't beat me to it, I could perhaps provide you with something more complete tomorrow...

 

Mylenium 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 12, 2022 Oct 12, 2022

Copy link to clipboard

Copied

thanks Mylenium, sorry I didnt think about screenshots. I thought it would be easier to visualize this way.

I know I have a rig with 2 keyframes, although they are markers and not key frames that work well. But the code is so long. Dan had incorporated the ease wizz into the code, and we had an inposition null and and an outposition null, with an expression on the in position, and then a complicated expression on the animation all for just 2 positions, so with 6 key frames ( or markers )  I cant even visialize how it could be.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 12, 2022 Oct 12, 2022

Copy link to clipboard

Copied

This is a complicated setup you have. Not only would it take quite a while to develop the code, it would take a while even to explain what's required. Part of the problem is that you have the text itself buried in a precomp that's 5 levels deep. So once you calculate right edge of the text, you need to translate that through 5 precomps to get to the main comp. And there's animation going on, so you need to make sure you pick the correct time (hardly-used second parameter of toComp) for the transforms. I believe there's also some animated time remapping in there too--not sure if that's an issue, but it might be. Then there's the issue of preserving your current eases. That's not too tough, but it can be if you need to make it general enough to handle wide deviation of values. In any case, what you want to do is certainly possible, but you might want to think about simplifying things just to make it easier to implement.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 12, 2022 Oct 12, 2022

Copy link to clipboard

Copied

Ok I will rework that and repost it. Thanks again

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 13, 2022 Oct 13, 2022

Copy link to clipboard

Copied

Agree with Dan. If your stuff is buried so deep and time-remapping is involved, it becomes basically un-expressionable. If you really want to manipulate it with expressions, it should be a flat hierarchy with one layer referencing another or at most stuff being in a pre-comp controlled from the main comp. Due to that valueAtTime() thing I mentioned yesterday evening it would also be good if the actual motion for your second layer was on a dummy/ prototype layer and not the one to be changed.

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 13, 2022 Oct 13, 2022

Copy link to clipboard

Copied

here is the project with no time remapping and only 1 precomp. In fact I made a composition with no precomps at all. You will notice markers in the first composition, these are driving the text transitions that force the transition to the middle of the text so that if the text length is changed by the user, the transition will adjust to the middle. this is very important. In the original project, the users had to move so many masks and keyframes, it was almost unusable. I apologize for my first project being so messy, I hope this one is easier to manipulate. I would very much like to have the first composition automated, but if only the second is attainable, then I will do my best to incorporate it into our workflow. Thanks to both of you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 14, 2022 Oct 14, 2022

Copy link to clipboard

Copied

I looked at both comps and the resulting animations. You could reproduce the entire animation with three layers. The first text layer would have an expression to move the layer into position based on the layer in point, an expression control slider to determine the timing, and a text animator driven by another expression to animate the text. The second layer would have a simple expression just to match the position of the first text layer, and a text animator controlled by an expression using the layer in-point to control the transition. The background layer would be tied to the first text layer with an expression and a Point Control to fine-tune the background's position.

 

All you would have to do is position the first text layer where you wanted it to end up, then add the other two layers, a Slider control to the first text layer and a Point control to the background layer, and a simple pickwhip expression to match the position of the first and second text layers.  There isn't any reason I can see for any of the other layers in any of the examples you presented. 

 

I have a dozen or so animation presets for animated text and graphics that perform very similar moves. If you incorporate sourceRectAtTime() height, width, top, left, comp size, and a couple of Expression Controls, you can automate almost any move with a simple animation preset. 

 

I don't have time to create all of the expressions for you, but here is one from one of my presets that matches a background shape layer to a text layer two layers above the shape layer background. Maybe it will give you some ideas.

 

 

t1 = thisComp.layer(index - 2);
p = t1.position;
box = t1.sourceRectAtTime(inPoint);
t = box.top;
h = box.height;
w = box.width/2;
l = box.left;
pAdj = effect("Pos Ofst")("Point");

x = p[0] + w + l;
y = p[1] + h + t;

[x, y] + pAdj

 

Add this expression to the background shape layer's anchor point and everything will stay lined up no matter what the paragraph settings are for the text layer.

s = sourceRectAtTime();
t = s.top;
h = s.height/2;
w = s.width/2;
l = s.left;

[w + l, h + t]

You could even compensate for text layer scale by multiplying the height and width by scale times .01

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

LATEST

thanks so much, although Im not fully clear on how to apply the first expression, or where. I will have to trial and error

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines