FORUMS: list search recent posts

Wiggle in one dimension with a floor

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Riccardo Sinti
Wiggle in one dimension with a floor
on Jun 5, 2013 at 4:15:00 pm

I've seen many posts on this problem but just cant seem to get how to do it or the get results I need form some of the expressions that have been posted.
Im using this expression on a 3d layer to wiggle only in the Y dimension.

w = wiggle(6,250);
[value[0],w[1],value[2]]

I would like to create a floor for the wiggle so my layer doesn't go below the floor.

I understand the clamp expression should be used but I am not sure how to add it to this expression.

Any help would be appreciated.

Thanks!


Return to posts index

Dan Ebberts
Re: Wiggle in one dimension with a floor
on Jun 5, 2013 at 5:12:49 pm

Maybe something like this:

minY = 100;
w = wiggle(6,250);
[value[0],Math.max(w[1],minY),value[2]]


Dan



Return to posts index

Xavier Gomez
Re: Wiggle in one dimension with a floor
on Jun 5, 2013 at 5:18:40 pm

To clamp below, you can use:

floor = 0;
y = Math.max( wiggle(6,250)[1], floor);
[value[0],y,value[2]]

Clamping a wiggle doenst work very well because while out of the bounds the final value (y-coordinate) will be constant.

Provided yours key values always stay above the floor, you can use instead:

floor = 0;
maxWiggle = Math.min(250, value[1]-floor);
w = wiggle(6,maxWiggle);
[value[0],w[1],value[2]]

Xavier


Return to posts index


Riccardo Sinti
Re: Wiggle in one dimension with a floor
on Jun 6, 2013 at 5:09:01 pm

Thanks guys for your help but none of those seem to do what I wanted.

I wound up using this which I cobbled from a the same question I realized I posted many years ago

w = wiggle(4,200) - value;
value + [value[0],-Math.abs(w[1])]

It kept my wiggle in the Y axis from dropping below the layer's original y start point but when I apply it the layer's x shifts so I have to relocate along the x axis. I guess that is from adding value + before the [value[0],
z is not affected I guess because it isn't mentioned in the array?

Any idea how to rewrite this so I can leave x and z dimensions alone.

The next thing I would like to do is be able to add an expression to scale so that when I scale the layer it's lower edge will always touch the floor.


Return to posts index

Dan Ebberts
Re: Wiggle in one dimension with a floor
on Jun 6, 2013 at 6:55:35 pm

This should work:

w = -Math.abs((wiggle(4,200) - value)[1]);
value + [0,w,0]


For the scale, couldn't you just move the Anchor Point to the middle of the bottom edge?

Dan



Return to posts index

Dan Ebberts
Re: Wiggle in one dimension with a floor
on Jun 6, 2013 at 6:59:54 pm

I may have misunderstood the second part. So you want to wiggle the layer in the y direction and scale it at the same time so that the bottom edge doesn't move, is that correct?



Return to posts index


Riccardo Sinti
Re: Wiggle in one dimension with a floor
on Jun 7, 2013 at 3:02:10 pm

That last expression works great and I actually understand how it is working.

"you want to wiggle the layer in the y direction and scale it at the same time so that the bottom edge doesn't move,"

That's right, I want the bottom edge to stay at floor level.

I don't want to move the anchor point because it rotates around center.

Thanks for all the help you give this community!


Return to posts index

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