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

Simple position expression.

New Here ,
Sep 22, 2021 Sep 22, 2021

Hi everyone
I'm just starting out in the field of expressions on after effect. I would have liked to know how to make a text start from a basic position and go up 50px. I don't understand Javascript at all and the tutorials I look for on the web don't help me much. I guess it's pretty simple but I get stuck.
If I translate it, I would have my [x] position which is fixed, my [y] position which starts from its base position and after 0,5 seconds my y position would have gone up 50px.
If someone can explain to me how to manage the animations and especially what value I have to modify to do that it would be great.

Thanks in advance.

TOPICS
Expressions , How to , Scripting
2.2K
Translate
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 ,
Sep 22, 2021 Sep 22, 2021

The interpolation expressions would be a great solution for that. You can set where to start and end the position and also what is the duration for that animation.

 

Check out this tutorial from Jake in Motion where you can get a lot of info on how to use it.

https://www.youtube.com/watch?v=2h9ZfUHVG6Q

 

Linear is an invaluable expression to know and understand in After Effects. It allows you to interpret any values in an unlimited number of ways, which is key to making custom controls. In this tutorial I'll walk you through a couple of demos to clearly explain the structure and functionality of ...
Translate
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 ,
Sep 22, 2021 Sep 22, 2021

You need something to initiate the start of the move like a marker or the layer in point, or a certain amount of time after the in-point. You need to define how many frames the move is going to take, then you need to put that value in an array that drives the position property. The Position property is an array comprised of X, Y, and Z values enclosed in square brackets. The original position of a 3D layer looks like this: [value[0], value[1], value[2]

 

If your goal is to define a new 'y' position after a few frames, then move it up for a few frames you have to define layer time as a variable, then interpolate between the minimum time and maximum time and set the starting value and ending value for the new 'y' variable. In the expression language menu in the timeline, you will find interpolation methods. To make the move look good I would choose the "ease" interpolation method. It looks like this:

ease(t, tMin, tMax, value1, value2)

To define the move time you can subtract the layer in point from comp time then just add some frames for the move time.

 

That's the thought process, this is how to write the expression:

layerStart = time - thisLayer.inPoint; //sets layer start time to zero
startOfset = 25 * thisComp.frameDuration; //frames before the move starts 
tMax = 50 * thisComp.frameDuration; //number of frames to move
t = layerStart - startOfset;
value2 = -50; // number of pixels to move
y = ease(t, 0, tMax, 0, value2);

[value[0], value[1] + y]

You could add two expression control sliders for the startOfset and tMax value.

Translate
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
Contributor ,
Oct 29, 2021 Oct 29, 2021
LATEST

To simply Rick's superb example, you can also do this for simplicity. No matter where you shift your layer, it will go up by 50 px from 0sec to 1sec. Hope it helps!

var x = value[0];
var y = linear(time, 0, 1, value[1], value[1] - 50);

[x,y];

 

Translate
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