ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Color if expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alexander Weil
Color if expression
on Nov 23, 2016 at 5:17:46 pm

hey
is there any way i can control the color with an if expression? it has to check that the value color is for example Blue, if that is true it has to change to a color i defined with a color controller, but if it is not it should use the value color
here is what i tried but it did not yet work:


cColor = effect("check Color")("Color"); //the color it should check
gColor = effect("Global Color")("Color"); //the color it should be if its the checked color
vColor = effect("Wales")("Color"); //the value color

if (vColor == cColor){
gColor
}else{
vColor
}



Return to posts index

Yahor Hayeuski
Re: Color if expression
on Nov 24, 2016 at 3:18:59 pm

Hi!
Color in AE is an array [red, green, blue, alpha]. And you can't compare two arrays using "==". More info here. Instead of this you need to check every value in array separately. Also you don't need to check alpha value (the last value (id = 3) in array). So this code should work for you:

cColor = effect("check Color")("Color"); //the color it should check
gColor = effect("Global Color")("Color"); //the color it should be if its the checked color
vColor = effect("Wales")("Color"); //the value color

if ((vColor[0] == cColor[0]) &&
(vColor[1] == cColor[1]) &&
(vColor[2] == cColor[2])){
gColor
}else{
vColor
}


Return to posts index

Alexander Weil
Re: Color if expression
on Nov 24, 2016 at 9:40:42 pm

thanks a lot, i already thought something like that but im not yet very deep into expressions.

thanks and have a nice day :)


Return to posts index

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