Linking opacity to xPosition ?

Moderators: Disciple, zlovatt

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

January 3rd, 2014, 5:53 am

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

January 4th, 2014, 10:19 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

January 5th, 2014, 3:35 am

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