FORUMS: list search recent posts

color change expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sean Kimber
color change expression
on Aug 30, 2013 at 9:44:50 pm

Hi,

I need to figure out a way to create an expression for a template. Here's what I'm looking to do.

I created an animation where I created some "concert lights" that had flares over them that changed colors. When I worked on it, I just manually changed the color on keyframes. However, I'm about to hand off the template to someone else, and I don't want him to have to go in and manually change keyframes, since this is going to be a weekly project. I'd like to provide a master "color change" comp where he can pick a primary color and a secondary color and it will update the flares to alternate between the two colors. I know how to link colors in a comp to a master comp's color picker. But I can't figure out how to alternate between the primary and secondary color in the same layer (and then make it loop, so it goes back to the primary color, etc).

Any help would be greatly appreciated.

Thanks!
Sean



Return to posts index


Kevin Camp
Re: color change expression
on Aug 31, 2013 at 12:20:35 am

you can't have an expression overwrite keyframes with new values, but you could use the timings of those keyframes to drive the interpolation between two new color values...

i'd create a null and add a color expression control effect to the null. rename the color control to 'Color 1' and then duplicate it (the duplicate will be named 'Color 2'). then set those two color chips to be two different colors.

then you should be able to add an expression like this to the color properties of the flares:

c1 = thisComp.layer("Null 1").effect("Color 1")("Color");
c2 = thisComp.layer("Null 1").effect("Color 2")("Color");

n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time) n--;
}

if (n%2==0){
linear(time,key(Math.min(n,numKeys)).time,key(Math.min(n+1,numKeys)).time,c1,c2);
}else{
linear(time,key(Math.min(n,numKeys)).time,key(Math.min(n+1,numKeys)).time,c2,c1);
}


and the color property should take on the new colors in the color controls. if you needed the color controls in a different comp, create the controls in that comp and then direct the expression to use the color controls ins that comp.

if you were using ease keyframes, change 'linear' in the expression to 'ease'.

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW


Return to posts index

Sean Kimber
Re: color change expression
on Aug 31, 2013 at 2:07:23 am

Thanks! I'll give it a shot!



Return to posts index


Sean Kimber
Re: color change expression
on Sep 3, 2013 at 5:50:15 pm

This worked perfectly! Thank you!



Return to posts index

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