Alexa Negrón Luciano, transgender and homeless, walked the streets of Puerto Rico neighborhoods hunched over, with a long towel covering her jet-black tresses.

She was a well-known figure on Puerto Rico social media, where people frequently posted photos and comments mocking her as something of an oddball bag lady.

On Sunday, the mockery turned deadly. Someone posted photos of Ms. Negrón being questioned by the police for supposedly peeping at another customer in a women’s bathroom at a fast-food restaurant, and the post went viral. Not 12 hours later, she was framed in the headlights of a car and shot to death amid a cackle of laughter — her final moments apparently also posted on social media.

At 27, Ms. Negrón became the latest example in a long legacy of violence against gay and transgender people in Puerto Rico.