Animation.h
int calculateStep(int prevValue, int endValue) {
  int step = endValue - prevValue; // What's the overall gap?
  if (step != 0) {                      // If its non-zero,
    step = 1020 / step;            //   divide by 1020
  }
  return step;
}
/* BELOW THIS LINE IS THE MATH -- YOU SHOULDN'T NEED TO CHANGE THIS FOR THE BASICS

    ##### TAKEN FROM THE ARDUINO TUTORIALS #####

  The program works like this:
  Imagine a crossfade that moves the red LED from 0-10,
    the green from 0-5, and the blue from 10 to 7, in
    ten steps.
    We'd want to count the 10 steps and increase or
    decrease color values in evenly stepped increments.
    Imagine a + indicates raising a value by 1, and a -
    equals lowering it. Our 10 step fade would look like:

    1 2 3 4 5 6 7 8 9 10
  R + + + + + + + + + +
  G   +   +   +   +   +
  B     -     -     -

  The red rises from 0 to 10 in ten steps, the green from
  0-5 in 5 steps, and the blue falls from 10 to 7 in three steps.

  In the real program, the color percentages are converted to
  0-255 values, and there are 1020 steps (255*4).

  To figure out how big a step there should be between one up- or
  down-tick of one of the LED values, we call calculateStep(),
  which calculates the absolute gap between the start and end values,
  and then divides that gap by 1020 to determine the size of the step
  between adjustments in the value.
*/


The program works like this:
Imagine a crossfade that moves the red LED from 0-10,
the green from 0-5, and the blue from 10 to 7, in
ten steps.
We'd want to count the 10 steps and increase or
decrease color values in evenly stepped increments.
Imagine a + indicates raising a value by 1, and a
equals lowering it. Our 10 step fade would look like.



The red rises from 0 to 10 in ten steps, the green from
0-5 in 5 steps, and the blue falls from 10 to 7 in three steps.

In the real program, the color percentages are converted to
0-255 values, and there are 1020 steps (255*4).

To figure out how big a step there should be between one up- or
down-tick of one of the LED values, we call calculateStep(),
which calculates the absolute gap between the start and end values,
and then divides that gap by 1020 to determine the size of the step
between adjustments in the value.
The program works like this : Imagine a crossfade that moves the red LED from 0 - 10 the green from 0 - 5 and the blue from 10 to 7 in ten steps . We ' d want to count the 10 steps and increase or decrease color values in evenly stepped increments . Imagine a + indicates raising a value by 1 and a equals lowering it . Our 10 step fade would look like . The red rises from 0 to 10 in ten steps the green from 0 - 5 in 5 steps and the blue falls from 10 to 7 in three steps . In the real program the color percentages are converted to 0 - 255 values and there are 1020 steps ( 255 * 4 ) . To figure out how big a step there should be between one up - or down - tick of one of the LED values we call calculateStep () which calculates the absolute gap between the start and end values and then divides that gap by 1020 to determine the size of the step between adjustments in the value .
int calculateStep(int prevValue, int endValue) {
  int step = endValue - prevValue; 
  if (step != 0) {                      
    step = 1020 / step;            
  }
  return step;
}
int calculateStep ( int prevValue , int endValue ) { int step = endValue - prevValue ; if ( step != 0 ) { step = 1020 / step ; } return step ; }
BELOW THIS LINE IS THE MATH -- YOU SHOULDN'T NEED TO CHANGE THIS FOR THE BASICS
 TAKEN FROM THE ARDUINO TUTORIALS
BELOW THIS LINE IS THE MATH -- YOU SHOULDN ' T NEED TO CHANGE THIS FOR THE BASICS TAKEN FROM THE ARDUINO TUTORIALS
// What's the overall gap?
 // If its non-zero,
 //   divide by 1020
