Activity › Forums › Adobe After Effects Expressions › Linking Fill Color to Rotation
-
Linking Fill Color to Rotation
Posted by Nick Adcock on May 3, 2010 at 9:22 pmI need to create a simple expression that links the fill of a layer to its rotation. I have many layers that all need to turn from white to different shade of blue as they turn. The don’t need to turn gradually just change at the 90 degree mark so when they flip over they are the blue color. So the color can turn on and off.
Thanks in advance.
Dan Ebberts replied 12 years, 5 months ago 4 Members · 7 Replies -
7 Replies
-
Dan Ebberts
May 3, 2010 at 9:51 pmPlay around with this fill color expression:
color1 = [255,255,255,255]; // white + alpha
color2 = [87,110,163,255]; // shade of blue + alpha
r = transform.rotation;
if (r > 90) color2/255 else color1/255Dan
-
Nick Adcock
May 4, 2010 at 2:06 pmThank you Dan and thank you for monitoring these boards like you do and being so damn good at actionscript.
I did a slight mod for the y rotation and different rotation values but it worked perfectly.
color1 = [255,255,255,255]; // white + alpha
color2 = [87,110,163,255]; // shade of blue + alpha
r = transform.yRotation;
if (r < -90) color2/255 else color1/255 -
Joel Young
April 1, 2011 at 1:52 pmI’m trying something similar to this, but I want the color to be driven by the value of a text layer. I’m going for a conditional statement, but even when I simplify it I am not getting the desired results. It seems to just return the value of the first if statement no matter what.
color1 = [255,255,255,255];
color2 = [0,255,0,255]; // Green
color3 = [255,0,0,255]; // Redc = thisComp.layer("Text1").text.sourceText;
if (c = "Green")
color2/255;
else if (c = "Red")
color3/255;
else
color1/255; -
Joel Young
April 1, 2011 at 4:09 pmWorks perfect. Thank you very much for showing me ==, now the search results show a lot more information.
-
Evan Hancock
November 28, 2013 at 5:45 amHi there,
I know this thread is quite old but had a question in regards to the following expression.
What do I add or replace to the expression to fade to from color 1 to color 2?
color1 = [255,255,255,255]; // white + alpha
color2 = [87,110,163,255]; // shade of blue + alpha
r = transform.rotation;
if (r > 90) color2/255 else color1/255 -
Dan Ebberts
November 28, 2013 at 7:57 amif you want the color to fade based on the value of r (say as r goes from 90 to 95), you could do it by replacing the last line with something like this:
linear(r,90,95,color1/255,color2/255)
Dan
Reply to this Discussion! Login or Sign Up