How can I make a rotary encoder change between neopixel programs?
I was wondering if there is a way to change the program immediately
  after turning the rotary encoder, instead of having to wait for the
  program to complete.


There is, but it's not completely trivial. The reason it is not trivial
is each animation is implemented as a function that takes a while to
execute. For doing what you ask, each of these animations should be
modified, with a way to exit early if needed.

One approach would be to manage the rotary encoder using an interrupt. I
let you investigate how to do that: you probably can find examples on
the Web. Once the encoder reading is interrupt-based, you would need to
do the following changes in your program:

At global scope, add



volatile bool stop_now = false;


This will be a sort of “flag” intended to inform the currently running
animation that it should return ASAP.

Then, inside the interrupt handler, add

stop_now = true;


In loop(), just after if (change != 0) {, add

stop_now = false;


In each animation, replace delay(wait) with:

uint32_t start_time = millis();
while (millis() - start_time &lt; wait) {
    if (stop_now)
        return;
}