The company in Justin Peck’s “Year of the Rabbit.” (Paul Kolnik)

An outbreak of eccentricity swept through the New York City Ballet at the Kennedy Center Opera House on Wednesday, and oh, what grand delirium ensued. It began as touches of comedy in Christopher Wheeldon’s “Soiree Musicale,” then progressed to a feverish view of community in Justin Peck’s “Year of the Rabbit.”

By the time Alexei Ratmansky’s “Namouna, a Grand Divertissement” took the stage, we were surely hallucinating.

Was that really the exalted ballerina Maria Kowroski in a wig like whipped cream, dragging lustily on a cigarette? What were the hooded spacemen in silvery blue up to, and who was that lover boy in a sailor suit who looked like he wandered in from a prewar Mediterranean port?

What a crazy night. What a wonderful night. To see three recent works, each one warmed by kooky wit and verve, all specially made for this company and capturing different facets of its spirit, character and energy: This is why we go watch dance.

There were all sorts of virtues in this program. Courage, first of all. At the tender age of 26, Peck has his pick of ballet commissions. But in 2012, when “Year of the Rabbit” premiered, he was truly green; this was only his second work for New York City Ballet, where he is also a dancer. Yet “Rabbit” is not timid. For starters, the way Peck uses the space is unusual and eye-catching. He has an architectural eye, like a Broadway choreographer mindful of the nosebleed seats. You see it in the way he builds his ensemble into rising and falling formations, all restless, excitable motion.

Peck chose difficult, caterwauling music by singer-songwriter Sufjan Stevens, re-orchestrated for strings, and he proves how eminently danceable it is. Courage is in full force here, and so is generosity. Perhaps because Peck was in the corps when he created “Rabbit,” he gives his corps the starring role. This ballet honors the casual, carefree bond among dancers. A recurring image: The women are slingshotted across the stage, skidding on their miniskirted bottoms. (Peck also designed the chic nautical-look costumes.) The men who sent them flying may be goofballs, but they’ve got manners: They offer a hand to help them up.

The principal dancers are outsiders at first. Teresa Reichlen and Robert Fairchild tiptoe about in faux fear. But trust wins out: They are soon absorbed into the tribe, and the searching, ever-optimistic ballerina Tiler Peck swan-dives into the ensemble’s arms. A group hug never looked so elegantly liberating.

Humor and ballet are a grand pairing, but few choreographers are brave enough to be silly. How lucky we were to see the works of these three, all with strong silly streaks. In his altogether pleasurable “Soiree Musicale,” Wheeldon plays with dance tunes by Samuel Barber, turning a tango into a cartoonlike vision of ever-multiplying men vying for one woman, Brittany Pollack, the luckiest girl on the planet. But it wasn’t all laughs: Lauren Lovette and Chase Finlay glided through their pas de deux in one unending, spiraling flow. It was a gorgeous surprise to discover a romantic nocturne in this work of light comedy.

Ratmansky’s “Namouna” shouldn’t have worked. It was an hour long, inspired by a 19th-century French ballet that flopped. Ratmansky’s account is surreal and only lightly hints at a story. But this is its strength. Ratmansky, perhaps the greatest ballet storyteller today, uses poetic means. Through weird and cheeky imagery and emotion, of which humor is a seamless part, he manages to depict yearning for love, overcoming obstacles (embodied by witchy sirens in short, black Louise Brooks wigs) and a bighearted celebration of misfits. Also, he has the music Edouard Lalo wrote for the original ballet, which is full-blooded, thundery and colorful. It was genius to dig this work up and genius to bring it to life. May New York City Ballet bring it here again.

The New York City Ballet performs Balanchine’s “Jewels” Friday through Sunday.