FORUMS: list search recent posts

setValue() to levels effect not returning expected value

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jeremy Dance
setValue() to levels effect not returning expected value
on Jul 28, 2017 at 4:28:12 pm

New to scripting here...
I'm trying to add a levels effect to a composition and set the value for "Input Black" and "Input White"

However, when I run the script in After effects I see values thousands above what I put in.

Here is my code:
myComp.property("Effects").property("Levels").property("Input Black").setValue(118);
myComp.property("Effects").property("Levels").property("Input White").setValue(141);

The value I get in After Effects are:
Input Black = 30090
Input White = 35955

On my last line of my code, I even added an alert to tell me the value of input white.
alert( . . . ("Input White").value);
It said the value for input white was 141 so I know nothing later in the code is changing it.

What am I not understanding?

myComp.property("Effects").property("Levels").property("Input Black").setValue(118);
myComp.property("Effects").property("Levels").property("Input White").setValue(141);


Return to posts index

Dan Ebberts
Re: setValue() to levels effect not returning expected value
on Jul 28, 2017 at 6:09:07 pm

Colors need to be normalized to be between zero and one. So this should work to get 141:

myComp.property("Effects").property("Levels").property("Input White").setValue(141/255);

Dan



Return to posts index

Jeremy Dance
Re: setValue() to levels effect not returning expected value
on Jul 28, 2017 at 11:18:03 pm

Thanks!

I'm curious as to where in the documentation I could learn more about this. I'm not sure what words to search in the scripting guide to find it. I'm sure I'll run into it more.

For example, I couldn't get the number I wanted for opacity until I multiplied it by (100/255). What causes that strange behavior?

myfxComp.property("Effects").property("Drop Shadow").property("Opacity").setValue(43*255/100);
The above line sets the percentage to 43%

myComp.property("Effects").property("Drop Shadow").property("Opacity").setValue(43*255/100);


Return to posts index

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