ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Changing the Start Point of a Shape Layer Size Animation

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Morgan Butler
Changing the Start Point of a Shape Layer Size Animation
on Sep 19, 2019 at 11:59:08 pm

Hi there!

Brand new to expressions, so I'm hoping someone can hold my hand on this one.

The project that I'm working on is a simple lower thirds animation where a shape expands (8,0) to (8,60) then the text reveals from both sides of the line. I'm trying to create this as a mogrt and would like control over the start point of the line animation, with the animation duration staying the same (15 frames). From what I've seen, this should be a pretty easy thing to do in 2019, however I'm stuck in 2018.

Does anyone know how to achieve this with expressions? Let me know if you need further information. In the office from 9 a.m. - 6 p.m. PST, I will respond as promptly as possible.

Thank you!


Return to posts index

Tomas Bumbulevičius
Re: Changing the Start Point of a Shape Layer Size Animation
on Sep 22, 2019 at 9:43:31 am

Hey Morgan, welcome to the expression world! While your description is pretty detailed, any chance you could add an image sample of your lower 3rd, to get a better understanding what should be affected when? Cheers!

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview


Return to posts index

Morgan Butler
Re: Changing the Start Point of a Shape Layer Size Animation
on Sep 23, 2019 at 4:45:11 pm

Hi Tomas,

I've you can view a screenshot of my AE work space here: https://imgur.com/a/RtFyG4g (I couldn't get the image upload to work). It's the last pair of keyframes for the top layer, 'Yellow Line' that I'm wanting to be able to control when they start relative to the text layer keyframes below.

I'm wanting this control because in attempting to make this mogrt as flexible as possible, I need the text to move so far into the mask area to account for longer names and titles, but the result of this is that for shorter names the text comes into the yellow line and behind the mask more quickly and so there's this bit of a pause before the yellow line collapses down to animate out.

I've done a bunch of tutorials on how to control keyframe values, but have had difficulty in finding how to control the timing of the keyframes and not the values.

Thanks for your help!


Return to posts index


Tomas Bumbulevičius
Re: Changing the Start Point of a Shape Layer Size Animation
on Sep 23, 2019 at 7:12:55 pm

Hey Morgan, thanks for an image - thats a lot more clear with a visual!

Few questions:
1. How line's animation IN relates to the keyframes? Is it going to change, or always remain the same few frames earlier from text?
2. The same about line's animation OUT - how it relates to the keyframes in text layer?
3. You also mentioned that duration should remain the same (15frames). You mean line animation between keyframes, right?

I believe this should be done by interpolation among keyframe times. Will drop you a suggestion once answers provided. Cheers!

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview


Return to posts index

Morgan Butler
Re: Changing the Start Point of a Shape Layer Size Animation
on Sep 23, 2019 at 8:00:48 pm

1. The line's animation IN 'can' always remain the same few frames earlier from text. I say can because aesthetically it doesn't bother me as much as the animation out. If it's not too much more difficult, I would like control over when the line animates in in relation to the text layer animation.

2. The line's animation OUT is what I'd like to have control over, in relation to the keyframes in the text layer.

3. Correct, I'd like the 15 frame animation line animation between keyframes to remain the same for the animation in and out.

So ideally, with the text animation staying the same, I'd like the ability in my mogrt to adjust when the two keyframes for the line's animation in and when the two keyframes for the line's animation out start, but I would be okay with just the out if it's easier.

Really appreciate your help!


Return to posts index

Tomas Bumbulevičius
Re: Changing the Start Point of a Shape Layer Size Animation
on Sep 24, 2019 at 8:00:45 am

Morgan, if I understood requirements correctly (that this should be controlled by keyframes of a text position keyframes), then this applied to 'Shape's size should be sufficient.

inDelay and outDelay are meant to control the gap from 1st and 3rd keyframes of position animation. Meaning, you could affect this linking it to a slider.
xSize and ySize are the sizes of line, pre-defined. You could also link them to slider to have a bit of extra control.

In case if its not what was needed, let me know and probably it could be tweaked to match the needs. Cheers.

xSize = 8; // Feel free to link these to sliders
ySize = 60 // Feel free to link these to sliders

startIn = thisComp.layer(index+2).transform.position.key(1).time;
startOut = thisComp.layer(index+2).transform.position.key(2).time;
endIn = thisComp.layer(index+2).transform.position.key(3).time;
endOut = thisComp.layer(index+2).transform.position.key(4).time;

inDelay = .5; // Feel free to link these to sliders
outDelay = .5; // Feel free to link these to sliders
animDur = 15 * thisComp.frameDuration;

if (time &lt; startOut){
lineIn = startIn- inDelay;
lineOut = lineIn + animDur;
y = easeIn(time, lineIn, lineOut, 0, ySize);
} else if (time > endIn){
lineIn = endIn + outDelay;
lineOut = lineIn + animDur;
y = easeOut(time, lineIn, lineOut, ySize, 0);
} else{
y = ySize;
}

[xSize, y]


Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview


Return to posts index


Morgan Butler
Re: Changing the Start Point of a Shape Layer Size Animation
on Sep 24, 2019 at 10:33:05 pm

Tomas thank you so much for your help!

It's working and it's amazing! I'm super appreciative of you taking the time to help me with this!!!

If I could ask for one final favor, I'm going to use the space below to step through the code that you provided if you could please make corrections in my understanding and there's a few questions in there.

xSize = 8; // Feel free to link these to sliders
ySize = 60 // Feel free to link these to sliders

- These are defining the size of the shape, I don't want to give editors control of the size so I am going to leave them as actual values

startIn = thisComp.layer(index+2).transform.position.key(1).time;
startOut = thisComp.layer(index+2).transform.position.key(2).time;
endIn = thisComp.layer(index+2).transform.position.key(3).time;
endOut = thisComp.layer(index+2).transform.position.key(4).time;

- Definitions are being created for startIn, startOut, endIn, and endOut (these could be any names).
- thisComp.layer(index+2) is defining what layer will be effected. However I'm confused here as I keep thinking index+2 will be effecting two layers below where this code is, which is my title text is, could you please clarify this for me?
- transform.position.key(1).time; this is changing the position (and therefor the timing) of the keyframe, 1, 2, 3 and 4 refer to the first, second, third and fourth keyframes of property of the layer being effected.

inDelay = .5; // Feel free to link these to sliders
outDelay = .5; // Feel free to link these to sliders

- This is what I am asking for control over, but again this is just a definition and inDelay and outDelay could be named anything.

animDur = 15 * thisComp.frameDuration;

- This is the distance between the keyframes that I want to keep and again animDur could be any name. I am a little confused here as to why it couldn't just = 15 and what the role of thisComp.frameDuration is. Is this because my comp frame rate is 29.97, but if I was to use the mogrt in a 60 fps project, = 15 would yield 1/4 of a second, instead of the desired 1/2 second?

if (time < startOut){
lineIn = startIn- inDelay;
lineOut = lineIn + animDur;
y = easeIn(time, lineIn, lineOut, 0, ySize);
}

- So now I think we're getting to the magic. This whole chunk is going to effect the animation of the line in.

if (time < startOut)

- I think this is saying if the current time (position of the play head) is before the position of the end keyframe of the animation in then we're going to do the following things.

lineIn = startIn- inDelay;

- Making another definition here based off of previous definitions that were made. This is taking the position of the first keyframe of the animation and adjusting it based on inDelay, which is controlled by a slider.

lineOut = lineIn + animDur;

- Same concept as above but instead of a slider, we are adjusting the last keyframe of the animation in by the 15 frame animation duration I requested.

y = easeIn(time, lineIn, lineOut, 0, ySize)

- Now this is actually transforming the properties of the y axis of the shape, which is how I was originally doing the animation with keyframes. easeIn is a function in After Effects for the Easy Ease In keyframe assistant. But how do you know what four things to put inside the function and in what order?

else if (time > endIn){
lineIn = endIn + outDelay;
lineOut = lineIn + animDur;
y = easeOut(time, lineIn, lineOut, ySize, 0);
}

- Same concept as above, except else if (time > endIn) is saying once the play head reaches the first keyframe of the animation out.

else{
y = ySize;
}

- Saying to keep the shape's y axis the same when time is not in those two other situations.

[xSize, y]

- I think this is what is actually creating the values of the shape. xSize is always define as 8 (xSize = 8) and instead of using ySize, which would keep the shape the same size all of the time, we are using the variable y which has three different functions attributed to it based on time.

Overall, my biggest questions are how did you know to use this: transform.position.key(1).time and how did you know what four values needed to go in here y = easeOut(time, lineIn, lineOut, ySize, 0)?

Again thanks so much Tomas!!! I'm going to try to apply what I've learned here to control the keyframe of the title on the animation out!


Return to posts index

Tomas Bumbulevičius
Re: Changing the Start Point of a Shape Layer Size Animation
on Sep 25, 2019 at 12:43:34 pm

Hey Morgan, you are welcome.

Wow, now thats a breakdown, haha! Will try to cover what you asked about.

1. By not adding a slider to change xSize or ySize in the Essentials panel, you will not allow others to change it. So just keep it in an expression the way it is set currently.
2. Yes, any variable names used are optional and you could give them any name you want, yet I made them descriptive at some degree.
3. thisComp.layer(index+2) references a layer, which is 1 layer below. Meaning, since the line in the comp is with an index of '1', result of 1+2 gets us a text layer and its keyframes. If, however, you plan to change the order or add extra layers in between, keep this in mind ☺
4. transform.position.key(x).time is setting variables for keyframes time values, where 'x' is a number of keyframe in layers position property.
5. inDelay and outDelay are just variables which allows you to make a 'shift' for key(1).time and key(3).time. Meaning, by changing these you will affect in and out times of the line.
6. animDur = 15 * thisComp.frameDuration; calculates 15frames in composition, based on time. In other words, we are multiplying frames by frame duration second wise, to get the length of animation in seconds. Seconds - because we are interpolating in seconds.
7. This link will answer questions about interpolation methods and why they are used here as is: http://expressions.aenhancers.com/interpolation.html

This should be it!

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview


Return to posts index

Morgan Butler
Re: Changing the Start Point of a Shape Layer Size Animation
on Sep 25, 2019 at 4:13:07 pm

Thanks for all your help Tomas, I'm starting to understand this expression stuff!!!


Return to posts index

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