Tint filter - Setting parameters

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
User avatar
vfxman
Posts: 49
Joined: February 23rd, 2007, 7:00 pm
Location: California
Contact:

Having trouble getting the "Map White To" parameter of the Tint filter to setValue correctly.

My line of code is like this:

Code: Select all

myComp.layer(10).Effects.addProperty("Tint");     //add filter
myComp.layer(10).property("Effects").property(1).property("Map White To").setValue([147.0, 186.0, 210.0]);     //set value
After running the script the color value ends up being set to:
R = 37,485
G = 47,430
B = 53,550

My project is set to 8 bit. I've ran multiple variations and I'm stumped at the moment. Any thoughts?
zold

Hi David.
Two things.
First (too bad an error does not arise to clue you in), the color value for this type of parameter is 4 dimensions, not 3. RGB and Alpha.
Second, the value of each dimension is from 0 to 1. (1=255).
So, your code really should be this (assuming you want R=147, etc.):

Code: Select all

//feel free to round these values; i asked AE for them
myComp.layer(10).Effects.addProperty("Tint");
myComp.layer(10).property("Effects").property(1).property("Map White To").setValue([0.57647061347961, 0.7294117808342, 0.82352942228317, 1]);
However,

Do this instead, because you want to be able to reference exactly the tint you want (in case there are multiple tints applied; this is generally a better way to structure this type of thing:

Code: Select all

newTint = myComp.layer(10).Effects.addProperty("Tint");//add filter, put that instance into a variable
newTint.property("Map White To").setValue([0.57647, 0.7294, 0.8235, 1]);//use that variable so we use the specific instance
Have at it!
User avatar
vfxman
Posts: 49
Joined: February 23rd, 2007, 7:00 pm
Location: California
Contact:

Thanks, that did it. I was use to setting values for solids and stuff and only needed the three RGB 0-255 value.
Post Reply