ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Move layer x pixels every nn frames

FAQ   •   VIEW ALL
 Move layer x pixels every nn frames on Jan 20, 2016 at 11:04:55 pm

would like to move my layer's position by an artbitrary amount of pixels in +x direction in a certain period of time.

Ideally, it would go something like this: Every half second, add nn to the x position of a layer using hold interpolation.

Or every 12 frames, jump the position xx pixels to the right.

So there would be a continuous progressive jumpy scroll to the right.

 Re: Move layer x pixels every nn frameson Jan 20, 2016 at 11:25:03 pm

This should work:

tStep = framesToTime(12);
jumpX = 10;
nSteps = Math.floor((time-inPoint)/tStep);
value + [nSteps*jumpX,0]

Dan

 Re: Move layer x pixels every nn frameson Jan 21, 2016 at 11:44:12 am

Hi Dan.
And how about random time and distance intervals ?
And smooth(ease) movement? : )

 Re: Move layer x pixels every nn framesby ido shoron Jul 31, 2016 at 2:10:55 pm

it would be great if you can add a smooth interpolation between "keyframes" to this expression.

 Re: Move layer x pixels every nn frameson Jul 31, 2016 at 6:10:20 pm

Maybe like this:

tStep = framesToTime(12);
jumpX = 10;
t = time - inPoint;
nSteps = Math.floor(t/tStep);
phase = t-(tStep*nSteps);
e = ease(phase,0,tStep,0,jumpX);
value + [nSteps*jumpX + e,0]

Dan

 Re: Move layer x pixels every nn framesby ido shoron Jul 31, 2016 at 6:20:29 pm

Tnx.... works like a charm. :)

 Re: Move layer x pixels every nn frameson May 22, 2020 at 4:28:01 pm

That's sweet. It would be posible to add a pause between those jumps??
Thank you

 Re: Move layer x pixels every nn frameson May 22, 2020 at 5:35:50 pm

Like this maybe:

``` tStep = framesToTime(12); tPause = framesToTime(10); jumpX = 10; t = time - inPoint; nSteps = Math.floor(t/(tStep+tPause)); phase = t-((tStep+tPause)*nSteps); e = ease(phase,0,tStep,0,jumpX); value + [nSteps*jumpX + e,0] ```

Dan