I had a dog that did that. He'd sit and the lower part of his right front leg would twitch uncontrollably although he didn't seem bothered by it. But then I noticed that his elbow joint was kind of swollen. I didn't put two and two together until he started limping. It turned out to be a tumor on his elbow joint and it was causing either pain that made him twitch or maybe just the twitch itself.