ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

y Position move with hold keyframe

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Olly Bea
y Position move with hold keyframe
on Feb 2, 2010 at 1:51:33 pm

Hey guys, I had a go at this, but I think its beyond my limited knowledge. There are just too many variable I need to concentrate on!!! Can anyone help?

1. I have a layer I would like to move up the screen in the y axis (the x does not change)

2. I would like the layer to move like a "hold" keyframe ie. not continuously, and the amount of time in between each move I can set.

3. Finally I would like the distance moved would initially be 9 pixels but this would also be adjustable.

Is this doable or am I being greedy?

Any help would be superb, otherwise I am going to have a keyframe marathon, and we all know keyframes are frowned upon!!!

Cheers

Olly



Return to posts index

Dan Ebberts
Re: y Position move with hold keyframe
on Feb 2, 2010 at 2:17:38 pm

Try this. Add sliders named "amount" and "delay" to your layer (be sure to set them to something other than zero) and apply this position expression:

amount = effect("amount")("Slider");
delay = effect("delay")("Slider");
t = inPoint;
y = 0;
while (t < time){
y += amount.valueAtTime(t);
t += delay.valueAtTime(t);
}
value - [0,y]



Return to posts index

Olly Bea
Re: y Position move with hold keyframe
on Feb 2, 2010 at 2:26:24 pm

Thats amazing, thank you, speedy response as well, much appreciated. You tha man!

Cheers

Olly



Return to posts index


Olly Bea
Re: y Position move with hold keyframe
on Feb 3, 2010 at 5:49:24 pm

Another thought regards this really good expression, if I may...

Can the delay slider work in frames per second? I am having trouble trying to accurately control it over time when its on a 0 - 100 increment.

Cheers

Olly



Return to posts index

Dan Ebberts
Re: y Position move with hold keyframe
on Feb 3, 2010 at 5:58:53 pm

This should make your delay slider work in frames rather than seconds:

amount = effect("amount")("Slider");
delay = effect("delay")("Slider");
t = inPoint;
y = 0;
while (t < time){
y += amount.valueAtTime(t);
t += framesToTime(delay.valueAtTime(t));
}
value - [0,y]


Dan



Return to posts index

Olly Bea
Re: y Position move with hold keyframe
on Feb 3, 2010 at 7:02:02 pm

I thought my head might explode trying to work that one out!

Thank you very much



Return to posts index


Fernando Almeida
Re: y Position move with hold keyframe
on Mar 26, 2010 at 3:22:25 pm

Hi All, I have similar question?
I would like to do a stop motion animation.
My idea is skip frames using Hold keyframes.
Is it possible to do with expression?
I would like to apply this expression for rotation and position.
Regards, Fernando.


Return to posts index

Dan Ebberts
Re: y Position move with hold keyframe
on Mar 26, 2010 at 6:01:15 pm

I'd start with posterizeTime(). You supply the desired fps. So, if you wanted 12 frames per second, it would be like this:

posterizeTime(12)

You'd apply it to each property you wanted to affect.

Dan



Return to posts index

Fernando Almeida
Re: y Position move with hold keyframe
on Mar 26, 2010 at 7:29:00 pm

Hi Dan, I try insert your expression in rotation property but a warning massage appear.
I have 2 key frames start rotation and end rotation.
When I press Rotation stopwatch with option(alt) a small code appear.
I remove it and insert your code, but not worked.
Look the image.
Image

transform.rotation

posterizeTime(12)


Return to posts index


Dan Ebberts
Re: y Position move with hold keyframe
on Mar 26, 2010 at 7:44:11 pm

Ah yes, sorry. Try this:


posterizeTime(12);
valueAtTime(time)



Dan



Return to posts index

Fernando Almeida
Re: y Position move with hold keyframe
on Mar 26, 2010 at 8:05:56 pm

It works!
Thank you very much!
Time is money ;)
Cheers


Return to posts index

Jk Patel
Re: y Position move with hold keyframe
on Jan 4, 2017 at 11:48:35 am

I have a similar question:

I want my later to move by 300 pixels up on the Y axis every time I hit a marker on the layer. Can this be done using an expression?


Return to posts index

Dan Ebberts
Re: y Position move with hold keyframe
on Jan 4, 2017 at 6:49:06 pm

Like this maybe:

n = 0;
if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (marker.key(n).time > time)n--;
}
value - [0,n*300]


Dan



Return to posts index

Jk Patel
Re: y Position move with hold keyframe
on Jan 5, 2017 at 11:12:18 am

Works perfectly.
Thanks Dan.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]