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

Position expression help

Community Beginner ,
Apr 12, 2020 Apr 12, 2020

Copy link to clipboard

Copied

Hello,

I'm looking for an expression that makes object moves horizontally from beginning of comp to end bassed on layer inPoint and outpoint

And let me control speed of moving

Thanks.

TOPICS
Expressions

Views

347

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
Explorer ,
Apr 12, 2020 Apr 12, 2020

Copy link to clipboard

Copied

dur = 10;

x = linear(time, inPoint, inPoint+dur,0,thisComp.widh);

[x,value[1]]

 

dur is the duration of the animation. So the bigger dur is, the slower the layer moves.

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 ,
Apr 13, 2020 Apr 13, 2020

Copy link to clipboard

Copied

If you mean that you want to have a layer move from one side of the composition to the other side then the speed of that move depends entirely on the time between the in and out point. 

 

If you want to control the speed then you can't care about the out point and you have already been given a solution.

Fix the typo (widh to width) in the expression andreip14565073  posted and you have an expression that will move a layer 0, in X to the other side of the comp in 10 seconds. Tie an expression control slider to "dur =" and you might have something you can use.

 

To have the motion controlled by the in and out points you need this:

t = time - inPoint;
et = outPoint - inPoint;
x = ease(t, 0, et, 0, width);
[x, value[1]]

To make it even more useful you could calculate the layer width and factor in the scale so that the layer would slide it from the left side and then exit on the right side all based on the layers in and out points. 

 

I have about a hundred of these that do all kinds of animation just based on the layers in and out points. I'll share one with you that will take any layer of any size or scale and fly it in from the left to any position you want, bounces to a stop, and then just before the layer ends it falls off the bottom of the screen. You'll see the code to tie size and scale in the animation preset.

https://www.dropbox.com/s/tewk9s88mpkmnou/flyInBounceDropOut.ffx?dl=0

 

Hope this helps.

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 Beginner ,
Apr 13, 2020 Apr 13, 2020

Copy link to clipboard

Copied

Thanks people for replying,

Its works good, but there is one thing else

The layer not starts from out of the comp

Half of it shown at start, can i make hole layer out in inPoint or may i change  anchor point ?

Sorry about my language

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 ,
Apr 13, 2020 Apr 13, 2020

Copy link to clipboard

Copied

If you want the layer to start outside of the frame so that it is not visible and end outside of the frame you need to add those dimensions to the position property. Did you look at the animation preset that I posted? The language to do that is included. It needs to be modified. The X value of the anchor point needs to be at the center of the layer. 

 

Here's the modified expression:

// Fix  layer size when scaled
sf = scale - [100, 100];
xSize = width + (width * sf[0]/100);
ySize = height + (height * sf[1]/100);
realSize = [xSize, ySize];
// Set Positions
spx = 0 - realSize[0] + realSize[0]/2 ;
rstx = value [0];
rsty = value[1];
epx = thisComp.width + realSize[0] - realSize[0]/2;
// create movement 
t = time - inPoint;
et = outPoint - inPoint;
x = ease(t, 0, et, spx, epx);
[x, value[1]]

 

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 Beginner ,
Apr 19, 2020 Apr 19, 2020

Copy link to clipboard

Copied

LATEST
  1. Thanks alot
  2. I appreciate your help
  3. Now I understood...

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