Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › How do I make the color change smooth.

  • How do I make the color change smooth.

    Posted by Joshua Bowman on December 27, 2018 at 4:59 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])

    Joshua Bowman replied 7 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Kalleheikki Kannisto

    December 27, 2018 at 9:03 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

  • Joshua Bowman

    December 27, 2018 at 6:17 pm

    Thanks!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy