Linking opacity to xPosition ?

Moderators: Disciple, zlovatt

Post Reply
AdamHoej
Posts: 2
Joined: January 3rd, 2014, 3:56 am
Location: Aarhus - Denmark

Hi!

I tried to solve this, but I'm having some problems.. I want my object to fade from MinOpa -> MaxOpa, when the requirements are met.


I really hope someone can help me out here!
How it looks now with the code posted below..

Code: Select all

//Position//
ConPos = thisComp.layer("Controller").transform.position[0];
CircPos = transform.position[0];

//Opacity//
MaxOpa = 100;
MinOpa = 5;

//Controllers//
s = thisComp.layer("Controller").effect("Tolerance Slider")("Slider");

//EXPRESSION//

if (CircPos>ConPos+s || CircPos<ConPos-s)
{
MinOpa

}else{

MaxOpa
};
beginUndoGroup
Posts: 81
Joined: November 27th, 2012, 6:41 am

Hi, you can try this:

Code: Select all

//EXPRESSION//
linear( Math.abs(ConPos-CircPos), 0, s, MaxOpa, MinOpa);
and also try replace linear by ease, or easeIn, or easeOut.

Xavier
AdamHoej
Posts: 2
Joined: January 3rd, 2014, 3:56 am
Location: Aarhus - Denmark

Thanks Xavier, that worked like a charm!


It all ended up like this

Code: Select all

//Position//
ConPos = thisComp.layer("Controller").transform.position[0];
CircPos = transform.position[0];

//Opacity//
MaxOpa = thisComp.layer("Controller").effect("Max Opacity")("Slider");
MinOpa = thisComp.layer("Controller").effect("Min Opacity")("Slider");

//Controllers//
s = thisComp.layer("Controller").effect("Tolerance Slider")("Slider");

//EXPRESSION//

ease( Math.abs(ConPos-CircPos), 0, s, MaxOpa, MinOpa);
Post Reply