Button doesn't control 2812 strip correctly

I'm pressed for time and I don't have your hardware and only know what I read about the library. Try the following code but I have no hardware to confirm:

#include <WS2812FX.h>

#define LED_PIN    6  // digital pin used to drive the LED strip
#define LED_COUNT 240  // number of LEDs on the strip

const int buttonPin = 2;

WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pinMode(buttonPin, INPUT_PULLUP);

  Serial.begin(115200);

  ws2812fx.init();
  ws2812fx.setBrightness(128);
  ws2812fx.start();
}

void loop() {
  static bool blinkFlag = true;
  
  static int lastButtonState = digitalRead(buttonPin);
  int currButtonState = digitalRead(buttonPin);

  if (currButtonState != lastButtonState)
  {
    delay(50); // debounce
    lastButtonState = currButtonState;
    if (currButtonState == LOW)
    {
      if (blinkFlag)
      {
        blinkFlag = false;
        ws2812fx.setSegment(0,  0,  9, FX_MODE_BLINK, 0xFF0000, 1000, false); // segment 0 is leds 0 - 9
      }
      else
      {
        blinkFlag = true;
        ws2812fx.setSegment(1, 10, 19, FX_MODE_SCAN,  0x00FF00, 1000, false); // segment 1 is leds 10 - 19
      }
    }
  }
  ws2812fx.service();
}

I will comment more in a while...