Highlighted

## Help with expression for position incremental stepping.

New Here ,
Jun 12, 2020

Copied

Hello,

My project has a block of animated text that I would like to animate incramental postion. Evert ten frames, I want the position of the layer to move x amount on the Y axis. Much like the ticking of a clock, only linear. I have tried the following expression, and it works great for fluid motion, but as I have stated, I want stepping motion at a specific incriment.

t = time;

s = 60;

v = t * s;

[value, value + v]

I know it is something pretty simple, but I am having a tough time finding such a specific answer. Any help would be appreciated.

Thanks!

If you want the property to jump in value every X number of frames all you have to do is divide the frame number of frames by the number of frames you want between moves, round the result, then multiply the property value you want to move by the change in value. Let's say that every 10 frames you wanted the Y position of a text layer to move up in y by 40 pixels. Let's start with the math, then build a value + array that lets you set the start position anywhere you want.

``````// set freqency and distance
countFrames = time/thisComp.frameDuration;
freq = countFrames / 10;
jump = Math.round(freq);
newY = jump * 40;
// Create Array
[value, value - newY]]``````

This could also be used to set the jump time to decimal parts of a second instead of frames.

If the timing needed to be seconds, no matter what the frame rate is you would use Time instead of Time/Frame Duration.  Let's say you wanted to have a second hand that snaps from one number to the next every second. The math is really simple there too. A clock face has 60 seconds in 360º so each second the second hand must jump 6º. The expression would use the same math round operator but you would not need to create an array. It would look like this:

``````// Universal Second Hand
value + Math.round(time) * 6``````

Topics

Expressions

Views

150

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more ## Help with expression for position incremental stepping.

New Here ,
Jun 12, 2020

Copied

Hello,

My project has a block of animated text that I would like to animate incramental postion. Evert ten frames, I want the position of the layer to move x amount on the Y axis. Much like the ticking of a clock, only linear. I have tried the following expression, and it works great for fluid motion, but as I have stated, I want stepping motion at a specific incriment.

t = time;

s = 60;

v = t * s;

[value, value + v]

I know it is something pretty simple, but I am having a tough time finding such a specific answer. Any help would be appreciated.

Thanks!

If you want the property to jump in value every X number of frames all you have to do is divide the frame number of frames by the number of frames you want between moves, round the result, then multiply the property value you want to move by the change in value. Let's say that every 10 frames you wanted the Y position of a text layer to move up in y by 40 pixels. Let's start with the math, then build a value + array that lets you set the start position anywhere you want.

``````// set freqency and distance
countFrames = time/thisComp.frameDuration;
freq = countFrames / 10;
jump = Math.round(freq);
newY = jump * 40;
// Create Array
[value, value - newY]]``````

This could also be used to set the jump time to decimal parts of a second instead of frames.

If the timing needed to be seconds, no matter what the frame rate is you would use Time instead of Time/Frame Duration.  Let's say you wanted to have a second hand that snaps from one number to the next every second. The math is really simple there too. A clock face has 60 seconds in 360º so each second the second hand must jump 6º. The expression would use the same math round operator but you would not need to create an array. It would look like this:

``````// Universal Second Hand
value + Math.round(time) * 6``````

Topics

Expressions

Views

151

Likes

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 Beginner ,
Jun 12, 2020

Copied

There's probably a way to code that in an expression, but you can't use a global variable in AE, so you would need to write a very messy code just to reproduce this effect. You are better off using keyframes for this IMO.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more Jun 12, 2020

Copied

If you want the property to jump in value every X number of frames all you have to do is divide the frame number of frames by the number of frames you want between moves, round the result, then multiply the property value you want to move by the change in value. Let's say that every 10 frames you wanted the Y position of a text layer to move up in y by 40 pixels. Let's start with the math, then build a value + array that lets you set the start position anywhere you want.

``````// set freqency and distance
countFrames = time/thisComp.frameDuration;
freq = countFrames / 10;
jump = Math.round(freq);
newY = jump * 40;
// Create Array
[value, value - newY]]``````

This could also be used to set the jump time to decimal parts of a second instead of frames.

If the timing needed to be seconds, no matter what the frame rate is you would use Time instead of Time/Frame Duration.  Let's say you wanted to have a second hand that snaps from one number to the next every second. The math is really simple there too. A clock face has 60 seconds in 360º so each second the second hand must jump 6º. The expression would use the same math round operator but you would not need to create an array. It would look like this:

``````// Universal Second Hand
value + Math.round(time) * 6``````

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more New Here ,
Jun 12, 2020

Copied

Thank you so much, Rick. I appreciate your reply, and the depth of your explaination. I read it twice, and it makes sense. I'll be applying this to my project as soon as I get back to work.

Thanks again,

JE

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more LATEST
New Here ,
Jun 12, 2020

Copied

I just used this expression and inserted the position offset that I calculated, and it works absolutely flawlessly. Thank you again.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more Resources Troubleshooting
Knowledge Base Articles
Getting Started