How to select LED Ws2812B Effect by button.

Hi every-one i am make a toy for me :smiley:
I has found source code for LED effects at here: https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/.
and i want to use a button to select effects. But i am a mechanical student, i can't understand structure of the command line.
I try more time but can't do it. So can you help me - How to do it? or give me a sample? or what command i should use?

Not a great tutorial. It's barely better than reading the examples that come with the library.

Try this one: Adafruit Multi-Tasking Tutorial

You might be able to use this as a baseline. All it does is read a switch on pin 2 (pressed == GNDed) and bumps an option variable. You should be able to use that variable to cycle through the effect you want to show.

#define SW_READ_INTERVAL    50ul        //mS between switch reads

const byte pinSwitch = 2;

byte
    option,
    swLast;

void setup( void )
{
    Serial.begin(9600);
    
    pinMode( pinSwitch, INPUT_PULLUP );
    swLast = digitalRead( pinSwitch );
    option = 0;
        
}//setup

void loop( void )
{
    static byte
        lastOption = 0xff;

    //read the switch
    ReadSwitch();

    //show how option value changes when button pressed
    if( lastOption != option )
    {
        lastOption = option;
        
        //print it to show the option value changed
        Serial.print( "Option " ); Serial.println( option );
        
    }//if
    
    //your code could act on the value of option to select which effect to play
    //...
    
}//loop

void ReadSwitch( void )
{
    byte
        swNow;
    unsigned long
        timeNow;
    static unsigned long
        timeSwitch = 0;
        
    //check the time
    timeNow = millis();
    //has our switch read interval passed?
    if( (timeNow - timeSwitch) >= SW_READ_INTERVAL )
    {
        //yes; set up for the next switch read
        timeSwitch = timeNow;

        //read the switch
        swNow = digitalRead( pinSwitch );
        //is is different than the last read value?
        if( swNow != swLast )
        {
            //yes; save the new as last
            swLast = swNow;
            //if new is low it means the button was just pressed
            if( swNow == LOW )
            {
                //so bump the "option" count; in this example it is limited to 16 values (0x0 ..0xf)
                option = (option + 1) & 0xf;
                
            }//if
            
        }//if
        
    }//if
    
}//ReadSwitch

Thank to Blackfin and MorganS for reply.
i will try with sample code of Blackfin