ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Y rotation based on position in composition

FAQ   •   VIEW ALL
 Y rotation based on position in composition on Nov 30, 2016 at 6:11:34 pm

I have a 3d bird that I have randomly fluttering around my comp (1920x2160) with a wiggle expression
I want to do two things:
1) keep the bird within the confines of the comp
2) have the bird's Y rotation be based on where in the comp he is. For example, when he is to the far left, he should be about 45 degrees and when he moves over to the far left, he should be about -45 degrees.

 Re: Y rotation based on position in compositionon Nov 30, 2016 at 8:20:30 pm

Maximum wiggle results can be tricky to manage. I think I'd start with something like this and tweak it until you get the results you want (assumes you're using a solid, would be different for something else):

freq = 1;
maxX = thisComp.width/2 - width/2;
maxY = thisComp.height/2 - height/2;
w = wiggle(freq,1)-value;
value + [w[0]*maxX,w[1]*maxY]

For rotation, possibly something like this:

linear(position[0],0,thisComp.width,45,-45)

Dan