FORUMS: list search recent posts

Position changes rotation expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Wick van den belt
Position changes rotation expression
on Nov 18, 2014 at 10:52:51 am

Dear Cow-Forum,

I have a very simple character that needs a certain expression that I just can't seem to figure out.
The main idea is that I want the Y-position of a certain layer to influence the rotation of another layer.

To kind of explain the situation : I have a character that jumps up and down. (So just 'bounces' on the y position)
I have a few separate layers which are the hairs of the character. (It's a round, fluffy type of character)
I have the hair layers parented to the main body, and I would like these to slightly rotate when the character moves up and down. If it would be just 1 shot I could obviously do that manually, but the character bounces around quite a lot so I think that an expression would work the best in this situation.

So it would be a kind of expression saying : If Position-value of 'Layer1' decreases rotate this layer X degrees. If position-value of Layer1 increases rotate this layer X degrees.

I hope anyone could point me in the right direction here.
Many thanks!

WickieMedia.net


Return to posts index


David Conklin
Re: Position changes rotation expression
on Nov 18, 2014 at 3:55:55 pm

To get this to work, you need to know what the Y-val of your character would be on the ground as well as when he's in the air. Additionally, you need to know what rotation vals you want those states to correspond to. Once you have those 4 values, it's a very simple expression to link the two. For instance you could put this expression on your hair layer's rotate property.

This expression, in simple terms, basically says as yPosition goes from 0 to 100, rotation goes from 0 to 60.

Hope it helps!

//get the jumping layer
var jump = thisComp.layer("jump_control").transform.position[1];

//get values
var groundY = 0; //the value of your character on the ground
var jumpY = 100; //the value of your character in the air
var groundRotate = 0; //the hair rotation on the ground
var jumpRotate = 60; //the hair rotation in the air

//use linear() to match these values
linear(jump, groundY, jumpY, groundRotate, jumpRotate);


Return to posts index

Wick van den belt
Re: Position changes rotation expression
on Nov 20, 2014 at 7:12:23 pm

Worked like a charm!

Thanks a lot!

WickieMedia.net


Return to posts index

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