Currently i have 2 animations in two rAF loops. For performance reasons i'm considering moving both to 1 loop. The constantly running animation is a small 3d wireframe in the site header, this is not stoppable and is present the moment the site is loaded. However i also have oscilloscopes and spectrum analysers that are only requesting animation frames when audio is played. The moment i pause, cancelAnimationFrame is called.
I have read that 1 rAF is usually better, but i'm having some second thoughts how i should achieve this. Should the constantly running rAF loop check 60 times a second for a variable having a boolean value, and when the value is true it should also run a function that holds the user triggered animations? Or are there any better solutions? What are your experiences?