ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How do I make the color change smooth.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Joshua Bowman
How do I make the color change smooth.
on Dec 27, 2018 at 4:59:55 am

I put in this expression to a audio spectrum to constantly change the color of the bars, but the problem is that the color change is spontaneous, it doesn't transition into the next color. Is there a way I can add a transition to this color change.

hues = [0,30,60,120,180,240,300];
freq = .5;
idx = Math.floor(time*freq)%hues.length;
hslToRgb([hues[idx]/360,.85,.4,1])


Return to posts index

Kalleheikki Kannisto
Re: How do I make the color change smooth.
on Dec 27, 2018 at 9:03:18 am
Last Edited By Kalleheikki Kannisto on Dec 27, 2018 at 9:04:23 am

For example like this, although this offsets the hue array by one.

hues = [0,30,60,120,180,240,300];
freq = .5; //changes per second
tran = .25; //seconds
idx1 = Math.floor(time*freq)%hues.length; //current hue index
idx2 = (idx1+1)%hues.length; //next hue index
state = linear(time%(1/freq),0,tran,0,100); //transition state (0-100)
hue = (hues[idx2]*state+hues[idx1]*(100-state))/100; // resulting hue
hslToRgb([hue/360,.85,.4,1])


Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Joshua Bowman
Re: How do I make the color change smooth.
on Dec 27, 2018 at 6:17:43 pm

Thanks!


Return to posts index

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