FORUMS: list search recent posts

Change the color depending on the value

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Plamen Benev
Change the color depending on the value
on Apr 21, 2013 at 1:46:31 pm

Hello ,

I need help with a project I'm working becouse my knowledge of operation with expressions are limited.
Basically i have to substract 2 values​​, and depending on the value that is returned to change the color of the layer automatically. For example, if the value that is returned is a positive color must become green or if it is negative then the color turns red.

Thanks in advance

comp("Graph / Single Ring 1").layer("Statistics").effect("Item 1")("Slider")-comp("Graph / Single Ring 4").layer("Statistics").effect("Item 1")("Slider")


Return to posts index

Dan Ebberts
Re: Change the color depending on the value
on Apr 21, 2013 at 8:34:39 pm

If you're using it to control a Fill effect color, for example, you could use something like this:

s1 = comp("Graph / Single Ring 1").layer("Statistics").effect("Item 1")("Slider");
s2 = comp("Graph / Single Ring 4").layer("Statistics").effect("Item 1")("Slider");
if ((s1 - s2) < 0) [1,0,0,1] else [0,1,0,1]



Dan



Return to posts index

Plamen Benev
Re: Change the color depending on the value
on Apr 22, 2013 at 2:58:48 pm

Тhanks for the reply
Its working but i have a question: Is it possible to use color for green 26.96.94 and for red 96.28.31. I try to use your expression logic but program back me error.

s1 = comp("Graph / Single Ring 3").layer("Statistics").effect("Item 1")("Slider");
s2 = comp("Graph / Single Ring 6").layer("Statistics").effect("Item 1")("Slider");
if ((s1 - s2) &lt; 0) thisComp.layer("col_control").effect("red")("Slider") else thisComp.layer("col_control").effect("green")("Slider")


Return to posts index


Plamen Benev
Re: Change the color depending on the value
on Apr 22, 2013 at 3:18:02 pm

I apologize for my previous post ...

I saw where my error. Confused basic syntax because my knowledge :)

s1 = comp("Graph / Single Ring 3").layer("Statistics").effect("Item 1")("Slider");
s2 = comp("Graph / Single Ring 6").layer("Statistics").effect("Item 1")("Slider");
if ((s1 - s2) &lt; 0) thisComp.layer("col_control").effect("red")("Color") else thisComp.layer("col_control").effect("green")("Color")


Return to posts index

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