There's new research that suggests anxiety is a symptom of depression, and researchers are trying to make anxiety one of the criteria for depression.
Sometimes when I'm depressed my mood will flip between sadness and anhedonia... but it's still depression nevertheless. Sometimes when I'm depressed I'll get anxious too
So if you believe the research, then it makes sense your mood is flipping like that.
If you're interested, I can try to dig up the link for the research