ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Y position drives xScale and opacity

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jonathan Lutjens
Y position drives xScale and opacity
on Apr 17, 2020 at 9:59:44 pm

Hi all,

I hope this finds you well, given the circumstances.
I've done some searching and haven't found a solution on my own. Hoping someone with deeper knowledge can help.
I have an animation setup for an Elephant (thank you Creation Effects for the great AE project!) and I'm adding a shadow to match the movement I've keyframed.
What I'd like to do is use the Y position of the end of the trunk (I have this value from the Elephant animation controls) to drive the shadow layer's opacity and XScale.
Opacity would be highest when the end of the trunk is closest to the ground (highest Y position value), and Xscale largest when the end of the trunk is farthest from the ground (lowest Y position value).
That way, when the trunk is hanging straight down and close to the ground, the shadow will be more compact and darker, and when the trunk is raised up, the shadow will be more spread out and lighter.


Return to posts index

sheikh ghanee
Re: Y position drives xScale and opacity
on Apr 22, 2020 at 12:37:14 pm

You can use value remapping technique to achieve this effect.
linear() - expression is helpful here.
Assign the below expression to scale of the shadow layer and edit "Name of Trunk Layer" in the expression.

yPosition = thisComp.layer("Name of Trunk Layer").transform.position[1];//Get the y position value of the trunk layer
// Here we set minimum and maximum for the value receive from trunk layer
inMin = 300;//the highest y position of trunk layer that affects the shadow layer
inMax = 600;//lowest y position of trunk layer
// Here we set minimum and maximum value for scale X of shadow layer
outMin = 100;//when trunk goes far from shadow, scale X increases till its hits value 100
outMax = 10;//when trunk comes near to shadow, scale X decreases till its hits value 10

scaleXaxis = linear(yPosition,inMin,inMax,outMin,outMax);

[scaleXaxis, 50]


Return to posts index

Jonathan Lutjens
Re: Y position drives xScale and opacity
on Apr 27, 2020 at 3:34:47 pm

Thank you, Sheikh! This is working great!
I appreciate you taking the time to answer me.

Cheers!


Return to posts index

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