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

position frame duration expression

Community Beginner ,
Oct 06, 2020 Oct 06, 2020

Copy link to clipboard

Copied

Hi, I made 5 diffrent pictures and I want them to change when I change x position , I have no idea how to do it with expressions so please help 🙂 image.pngimage.png

TOPICS
Error or problem , Expressions , How to

Views

584

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

correct answers 1 Correct answer

Community Expert , Oct 06, 2020 Oct 06, 2020

When you use and expression to drive time remapping you have to write the expression so it delivers the time of the frame you want to see. The easiest way to convert a number into a frame is to divide it by the frame rate. An easy way to get the frame rate is to divide 1 by the comp's frame duration. 

 

The next step is to figure out how many pixels you want to move before you increase the frame count by 1.  You can either pick a number like 10 pixels or you can divide the comp width into the nu

...

Votes

Translate

Translate
Community Beginner ,
Oct 06, 2020 Oct 06, 2020

Copy link to clipboard

Copied

look for info on "time remapping"

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 ,
Oct 06, 2020 Oct 06, 2020

Copy link to clipboard

Copied

yeah , Im looking for an expression that links time remapping with position and couldn't find anything !

 

 

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 ,
Oct 06, 2020 Oct 06, 2020

Copy link to clipboard

Copied

ok try to work around these :

on your precomp layer position  : paste :

 

 

xy= value; //pair of coordinates

x= xy[0];
y= xy[1];

[x+timeToFrames(timeRemap*200),y]

 

to go the other side, from position to timeremap, try this on timeremap of another precomp layer :

transform.position[0]/1000

 

these won't do exactly what you want, see them as starters, to get you started

🙂

 

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 06, 2020 Oct 06, 2020

Copy link to clipboard

Copied

When you use and expression to drive time remapping you have to write the expression so it delivers the time of the frame you want to see. The easiest way to convert a number into a frame is to divide it by the frame rate. An easy way to get the frame rate is to divide 1 by the comp's frame duration. 

 

The next step is to figure out how many pixels you want to move before you increase the frame count by 1.  You can either pick a number like 10 pixels or you can divide the comp width into the number of sections that you want to use. If you round the position change by the distance between frames and then divide that by the frame rate you will make time remapping jump to the next frame every time the layer moves the distance you have set between frames.

 

Up to this point, the expression would look like this:

fps = 1/thisComp.frameDuration;
distBtwnFrames = thisComp.width / 10;
posChange = position[0];
fr = Math.floor(posChange / distBtwnFrames)/fps;

You've got to fix your pre-comp so that it doesn't have a blank frame - it needs 4 layers, not 3, or you have to set the pre-comp to 3 frames and eliminate the empty frame. 

 

Move the layer to the left side of the comp and you will see frame 1, then it will switch to frame 2, then 3, 4, the frames will be used up and the screen will go blank. 

 

You'll need to set up a loop to keep repeating the first frames as the layer moves from left to right. It's been a long day and I'm not sure how to write that loop without opening up AE and fiddling for a while. Maybe somebody else will step in and finish the expression for you, but this much should make your animated graphic take 4 steps (3 steps if you don't have another drawing) as you move the layer from the left side of the screen to the right until you run out of frames. 

 

Somebody like Dan Ebberts could write the looping part of the expression in about 2 seconds, and maybe even clean up the rest of it a bit, but this will get you started. 

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 ,
Oct 06, 2020 Oct 06, 2020

Copy link to clipboard

Copied

LATEST

Thank you so much 

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