As an exercise, I wanted to dissect this brush and learn how it works via the brush controllers, and I thought writing it down for others to benefit might be helpful.
Making the string shape:
Shape Setting- adjust the size to vary between 0 and X, in this case, 20px.
Length - an ever increasing value -->Feeds into Sinus
Sinus - takes the ever increasing # and applies a sin() function to it, creating a value that varies between -1 and 1 continually. Sinus Amplitude set at 1.2 - this is so the output range varies between -1.2 and +1.2 (more than the size brush parameter can handle). Feeds to Abs
ABS - Takes the Absolute value of the Sine wave, giving us a wave that ranges from 0 to 1.2. If you do not apply the ABS function, the system sends a less than one signal to the length, which, is zero length.
The total wave will CLIP (the hard edge of the candy) between 1.0 and 1.2 giving you an output that goes from 0 to 1.0..waits for a second and 1, and then goes back down to 2.
Creating the shading from string to candy center and back again
Color Setting: A Fixed Gradient from black to a single candy color. This gives us our range.
Adjust the COLOR brush parameter - we will go back and forth along that gradient (0 to 1 to 0) at the same rate of the size. No need for clipping (with a 1.2 sinus wave amplitude here) because the gradient just works with out it.
otherwise, IF YOU WANTED to shrink the shadow, and stay at the higher end of the gradient for longer, and introduce sine wave clipping, you would Increase the amplitude)
Varying color between EACH piece of candy
What is changing here is the HUE - which is the variation between colors, not the darkness of the color (value) or the intensity of the color (saturation)
The Hue is set to vary between a unique set of values from 23 degrees to 359 degrees... This was determined by experimentation.
The HUE controller then varies inside of that range...
INPUT - LENGTH - an ever increasing value
LENGTH ADDED to 0.15 - which gets us passed the first bump in the sine wave
FRAC The fractional value of that input is taken (so, we start at 0.15, go up to 1 linearly, and then start over at 0.
MUL - Input now varies between 0 and 4 (0.15x4 to start = 0.6 to 4, and then just 0 to 4 again.
FLOOR FUNCTION - creates STEPS, so values sit at 0000000 then 1111111 then 22222 then 3333333 then back to 00000000 - there is no output of 1.3, 2.7, or 3.884 - the FLOOR quantizes the outputs.
DIV - The DIV function brings us back down in the 0 to 1 range, but gives us 000000 .25 .25 .25 .25 .5 .5 .5 .5 .75 .75 .75 .75 and then back to 000000.
So the hue controller is essentially a stepper function.. interesting.
I have been using Photoshop for 10 years creating digitally printed wallcovering.
I have an electrical engineering degree with a minor in math.
I am a freelance designer, writer, and developer. matt @ remarkable team dot com