How to prototype graphical animation using C++ on Linux?

My suggestion will be ditch all the giant GUI frameworks (Qt, GTK…) and find a simple game library that just opens a window and you can directly call something like draw_line() in it.

For example, here is raylib drawing some lines:

Raw graphics APIs (OpenGL, Vulkan) are not recommended for your use case too, they need you to do a lot of setup and deal with shaders, pipelines, weird state machine (OpenGL), etc.