TRENTON — Krystal Knapp was 15 minutes from the end of her shift as a volunteer at the entrance to the Art All Night festival in Trenton when she heard some scuffling.

Peering into the long and narrow former factory building where the festival was being held, she saw paintings being knocked to the floor. She heard screams and gunshots as people hurtled toward the exit and she was pushed to the ground and trampled.

Ms. Knapp sought shelter behind a car. Then, 15 feet away, one of the gunmen was shot and killed.

[Read: Trenton Grieves After Shooting at Event That Was ‘a Beacon’]

The authorities said the shooting appeared to be gang-related and that 22 people were injured; 17 were shot and the others hurt by being trampled. It happened just before 3 a.m. Sunday at a 24-hour art festival cherished by Trenton residents as a testament to the New Jersey capital’s artistic revitalization.