animations interactive in real time 1st Goal - make animations change based on serial

animations interactive in real time
1st Goal - make animations change based on serial data , most probably from PROCESSING .
i found this code , where daniel describes the protocol, this is clear, my question is , how to accommodate the serial.read() , in order to ti interfere with the Fasted.show , and at the same time for the serial port to work fine ? , thank you
code from kasperkamperman ,

What do you main with interfere with Fastled.show? With if or a switch statement your can listen to the commands and control several variables with it in your program. For example: if(aCmd.type == 1) { // do something with the value aCmd.cmdValue0;
}

Avoid timing conflicts
What is not clear to me is where to locate de serial read . Or better the if serial.available () .
In order to be executed without missing information . But at the same time without blocking the leds. Update .
Thanks

To avoid conflicts with a show, I always process any communications only right before I call show. I actually put the check for these things inside another function “MyShow()” and then call FastLED.show() after I do all that other processing. You may lose a bit in your timing but you get all your communications.

Justin’s solution will work most of the time, but if you need to be certain that data doesn’t get lost, you could have the controller ask for the data when it’s ready (avoiding the situation where data is available but the controller isn’t listening).