I just added this to an app I’m working on! It will depend on the flow that you have and the actions users are taking.
For mine, I have a button with a custom action - the first action triggers the loading GIF and the last action clears it.
I believe whatever flow you have that will be the key - a custom action linked to a button or other component:
Action 1: set column that triggers visibility of the GIF
Action 2: [whatever function you need to perform]
Action 3: clear column that triggers visibility of the GIF
