Skip to main content
Inspiring
February 9, 2022
Answered

Change HUE expression

  • February 9, 2022
  • 2 replies
  • 1756 views

Hey guys!

 

I need to do an effect that recolors parts of a drawing.

I have each section of it that I want to recolor already separated.

What I need now, is to put an expression in the HUE value slider, to make it animate but skip say, 10 values at a time?
This way I don't get a color fade, instead I get different color steps.

My understanding of how this works tells me it'll be some sort of math.floor and dividing the results by the amount of numbers I want to skip, right?

This topic has been closed for replies.
Correct answer Mylenium

Pretty much correct, though you will need to adjust the ranges since color ranges are float values in expressions:

 

mSlider=thisComp.layer("XYZ").effect("Slider")("Slider");

mStep=10;

mSkip=1/255/mStep;

mHue=Math.floor(mSlider)*mSkip;

mCol=hslToRgb([mHue,1,1]);

 

Mylenium

 

 

2 replies

Mylenium
MyleniumCorrect answer
Legend
February 9, 2022

Pretty much correct, though you will need to adjust the ranges since color ranges are float values in expressions:

 

mSlider=thisComp.layer("XYZ").effect("Slider")("Slider");

mStep=10;

mSkip=1/255/mStep;

mHue=Math.floor(mSlider)*mSkip;

mCol=hslToRgb([mHue,1,1]);

 

Mylenium

 

 

G5CD7Author
Inspiring
February 9, 2022

Actually, it's working in the Hue/Saturation effect!
Maybe it wasn't possible back when he posted that and now it is...

I need to tweak it for one thing though. I like that it's speeding up over time (coincidentally I also wanted this).

But, I need it to speed up more often and by more, as in, accelerate I guess.

So... if I do 50 there instead of 10, it'll just make it jump 50 numbers instead of 10, right? Does nothing to accelerate.

And if I add to the +1, that's a separate thing, right? Doesn't seem to do much either.
My animation is only 30s long so there's not a lot of time for it to ramp up.

It needs to be a... What do you call it. Exponential progression? Where with each acceleration step, it speeds up by a larger factor?

G5CD7Author
Inspiring
February 9, 2022

Found it!

posterizeTime(Math.round((time/10)+1)); random(360);

 

Credit to this guy: https://www.reddit.com/r/AfterEffects/comments/c9kw4m/random_hue_expression/