Hanzo has a condition called “luxating patella,” or “kneecap fell out of place and is floating around like a kid with an illicit hall pass.”

(Dark as the inside of my dog's leg...)
Usually, this happens to small breeds like Yorkshire terriers or pomeranians, in which case it’s congenital. Sometimes, it happens to larger dogs, especially active jumpy ones like our spazzy little pitbull. We don’t know how it occurred. It could have been trauma that we didn’t witness (or that we underestimated the impact of), or it could have been uneven development in his hind legs that stretched out the ligament. Apparently sometimes dogs with muscular legs get a slightly bowed bone as they develop, and that creates sideways pressure on the patella.
He’s going in for surgery tomorrow morning. If I understand correctly, the vet is going to deepen the groove in the femur (top white blob) where that little bean-shaped thing (patella) is supposed to go, then stuff it back in, and attach the loose ligament to a pin in the tibial ridge (poky bit on the right of the bottom white blob) so it doesn’t come loose again. Captain Jumpytron will have to remain quiet and mostly still for six weeks.
Because if he doesn’t, he’ll have to have surgery again, and then be still for twelve weeks. (As you can see below, that is going to be impossible without a boatload of tranquilizers.)
Poor Hanzo.