LED looping until a new IR button is pressed

Hi all - hoping someone can guide me here, i’ve been wracking my brain and just not getting anywhere.

Overall I’m trying to get a LED strand to do an animation on a loop when a button is pressed and stay doing that loop until a different button (different animation) is pressed.

In the code I have two particular instances I’ve been looking at colorChase (button5) and Wipe2 (Button 7)

They do the same thing, minus color - just different approaches. I cant figure out how to make either of them loop indefinitely until the other button is pressed. Any help / guidance?

#include <Adafruit_NeoPixel.h>      //  Library for WS2811/WS2812b Led strips
#include "IRremote.h"               //  Library for IR Remote

#define IR_Receiver           7    //  Pin 1 of IR receiver to Arduino digital Pin 11
#define LED_PIN               13    //  Data Pin of Led strip
#define LED_COUNT             36    //  Number of LEDs in your strip
#define StatusLed_PIN         12    //  [OPTIONAL] Pin of the status Led
#define SPEED                 100    //  Speed of each Color Transition (in ms)
#define NOW                    0    //  Transition happen instantly
#define RAINBOW_SPEED         10    //  Rainbow Transition speed
#define RAINBOW_REPEAT         1    //  How many times the Rainbow Cycle is repeated
#define BRIGHTNESS            55    //  Initial Brightness
#define BRIGHTNESS_INCREMENT  50    //  Increase/Decrease Brightness by this value
#define MIN_BRIGHTNESS         5    //  Minimum Brightness
#define MAX_BRIGHTNESS       255    //  Maximum Brightness

#define  OFF         0, 0, 0           //  OFF
#define  RED         255, 0, 0         //  Red
#define  GREEN       0, 255, 0         //  Green
#define  BLUE        0, 0, 255         //  Blue
#define  WHITE       255, 255, 255     //  White
#define  GREY        100, 100, 100     //  Grey
#define  ORANGE      153, 255, 0       //  Orange
#define  MINT        255, 0, 178       //  Mint
#define  DARK_BLUE   51, 0, 102        //  Dark Blue
#define  BROWN       85, 175, 0        //  Brown
#define  AQUA        171, 0, 183       //  Aqua
#define  PURPLE      0, 85, 204        //  Purple
#define  BEIGE       155, 206, 2       //  Beige
#define  TOPAZ       250, 0, 255       //  Topaz
#define  FUCHSIA     0, 242, 255       //  Fuchsia
#define  YELLOW      255, 255, 0       //  Yellow
#define  SKY_BLUE    144, 0, 255       //  Sky Blue
#define  PINK        89, 247, 168      //  Pink

int currentBrightness;              //  This will save the current Brightness
int buttonPushCounterA    =    0;   //  Counts how many times the button has been pushed
int buttonStateA          =    0;   //  Current state of the button
int lastButtonStateA      =    0;   //  Previous state of the button
int period = 1000;
unsigned long time_now = 0;
long lastPressTime = 0;
int state = LOW;
int lastbutton = 0;
int currentbutton = 0;

//  Initialize Led Strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

//  Initialize IR Receiver
IRrecv irrecv(IR_Receiver);         //  create instance of 'irrecv'
decode_results results;             //  create instance of 'decode_results'

void setup() {
  Serial.begin(9600);                         //  Start Serial Monitor, Baud 9600
  Serial.println("Starting Serial Monitor");  //  Print Message
  irrecv.enableIRIn();                        //  Start the IR_Receiver
  strip.setBrightness(BRIGHTNESS);            //  Set Initial Brightness
  strip.begin();                              //  Initialize the strip
  strip.show();                               //  Update the strip
  digitalWrite(StatusLed_PIN, HIGH);          //  Turn on Green LED when the program is ready
}

void loop() {

  if (irrecv.decode(&results)) {                // Check if an IR signal is received
    Serial.print(results.value, HEX);           // Display buttons RAW values in Serial monitor
    RGB_Remote();                               // Functions of remote in the next tab
  }
}

void RGB_Remote()  {                           //  Functions for IR Remote

  int currentButtonStateA = digitalRead(IR_Receiver);

  digitalWrite(StatusLed_PIN, LOW);          //  Blink the Status LED when an input is received
  delay(70);
  digitalWrite(StatusLed_PIN, HIGH);


  switch (results.value)  {                          //  IR Remote buttons

  
    case 0xFF9867:
      Serial.println("     RED");
      colorWipe(strip.Color(RED), SPEED);              //  Red
      break;
    case 0xFF30CF:          // Remote 1
      Serial.println("     WHITE");
      colorWipe(strip.Color(WHITE), SPEED);            //  White
      break;

    case 0xFF18E7:          // Remote 2
      Serial.println("     BLUE");
      colorWipe(strip.Color(BLUE), SPEED);             //  Blue
      break;

    case 0xFF7A85:          // Remote 3
      Serial.println("     GREEN");
      colorWipe(strip.Color(GREEN), SPEED);            //  Green
      break;

    case 0xFF10EF:          // Remote 4
      Serial.println("     YELLOW");
      colorWipe(strip.Color(YELLOW), SPEED);           //  Yellow
      break;

    case 0xFF38C7:          // Remote 5
      Serial.println("     CHASE");
      colorChase(SPEED);    //  Color Chase

      break;

    case 0xFF42BD:          // Remote 7
      Serial.println("     WIPE2");
      colorWipe2(strip.Color(GREEN), strip.Color(YELLOW), SPEED); //  Chase_GB
      colorWipe2(strip.Color(YELLOW), strip.Color(GREEN), SPEED);
      break;

  }
  delay(50);                                       //  short delay
  irrecv.resume();                                 //  Ready to receive the next input

}

void colorChase(uint8_t wait) {

  colorWipe2(strip.Color(BLUE), strip.Color(WHITE), SPEED);
  colorWipe2(strip.Color(WHITE), strip.Color(BLUE), SPEED);
  showStrip();
  delay(wait);
}


void colorWipe2(uint32_t c, uint32_t c2, uint8_t wait) {

  for (uint16_t i = 0; i < strip.numPixels() / 2; i++) {
    strip.setPixelColor(i, c);
    strip.setPixelColor(i + strip.numPixels() / 2, c2);
    strip.show();
    delay(wait);
  }
}

void colorWipe(uint32_t c, uint8_t wait) {

  for (uint16_t i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}



void showStrip() {
#ifdef ADAFRUIT_NEOPIXEL_H
  // NeoPixel
  strip.show();
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
  // FastLED
  FastLED.show();
#endif
}



void setPixel(int Pixel, byte red, byte green, byte blue) {
#ifdef ADAFRUIT_NEOPIXEL_H
  // NeoPixel
  strip.setPixelColor(Pixel, strip.Color(red, green, blue));
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
  // FastLED
  leds[Pixel].r = red;
  leds[Pixel].g = green;
  leds[Pixel].b = blue;
#endif
}


void setAll(byte red, byte green, byte blue) {
  for (int i = 0; i < LED_COUNT; i++ ) {
    setPixel(i, red, green, blue);
  }
  showStrip();
}

//  COLOR WHEEL USED BY RAINBOW COLORS

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.

uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if (WheelPos < 85) {
    //    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);  //  R
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);  //  G
  }
  if (WheelPos < 170) {
    WheelPos -= 85;
    //    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);  //  G
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);  //  R
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);    //  B
}

Your current code only calls the RGB_Remote() function when you receive a new code. You will have to chang that to call it every time through loop(). You also have to break down your functions so they don't try to do the entire pattern before returning. They will have to do more of a single step and then return and then the next time through loop() it takes the next step.

Look at the Several Things at a time for more guidance.