Considered deeply uncool at one point, music from animated movies is back — and singing along is now not only OK for kids, it’s something adults record themselves doing on their phones and share on YouTube.

The boom in popular songs from animated movies comes after a long fallow period when the form yielded few hits in the music world, despite box-office juggernauts like the “Toy Story,” “Shrek” and “Ice Age” franchises. Though all incorporated music in their films, it was rarely the kind that had come to define the genre at Disney Animation in the late 1980s and early 1990s, when it was making music-driven hits like “The Lion King,” “Beauty and the Beast” and “The Little Mermaid.”

“You had this shift ... where there were very successful animated movies but their soundtracks weren’t,” said Ken Bunt, president of Disney Music Group. “Their scores were important, but they weren’t musicals and the music in them wasn’t something that gets played on radio or that you’re singing in your car.”

A sign of the shift: For the first time in 20 years, a soundtrack from an animated film has been No. 1 on the Billboard charts for 10 weeks.

Last week, Disney’s fairy tale “Frozen” displaced 1994’s “The Lion King” to become the top-selling animated movie soundtrack of all time. It’s not the only music from an animated film that’s hot right now: “Happy,” Pharrell Williams’ ubiquitous mood booster from “Despicable Me 2,” has been No. 1 on the single charts for eight weeks and appears everywhere from Fiat commercials to kids’ choir homages.

Earlier this year, “The Lego Movie” popularized a catchy electronic parody song called “Everything Is Awesome,” and “Rio 2” is receiving lots of praise from critics for the quality of its eclectic, Brazil-influenced soundtrack.

In some cases, as with “Frozen,” the music helped drive the box office, as audiences started learning songs from the radio before they saw the film; in others, as in “Despicable Me 2,” the song’s hit status came well after the film’s box-office release and evolved into a story of its own. Regardless, the cloud on animated musicals has clearly lifted.

“There hadn’t been a musical in such a long time,” said Bill Damaschke, chief creative officer of DreamWorks Animation, which has a Bollywood-style musical composed by A.R. Rahman and an Australia-set project from Tim Minchin, the composer of the Tony Award-winning show “Matilda the Musical,” in development. “A really great one came out (‘Frozen’) and it hit a nerve. Everybody’s asking, ‘What are fresh, original ways to use music in animated movies?’ “

One of the key features of the “Frozen” and “Happy” phenomena has been social media. According to Bunt, fans have uploaded more than half a million versions of the “Frozen” empowerment ballad “Let It Go” to YouTube.

Oprah Winfrey recently brought Williams to tears by showing him a collection of fan-made “Happy” videos from around the world.

“It’s sort of like a community singalong in the virtual town square,” said Tom Sito, a professor at USC’s School of Cinematic Arts who was an animator and storyboard artist at Disney Animation in the 1990s. “And it keeps the material fresh in people’s minds.”

In addition to the Rahman and Minchin musicals it has in development, this year DreamWorks will release “How to Train Your Dragon 2” with two songs by Jonsi, the frontman from the Icelandic rock band Sigur Ros, and “Home,” an alien invasion movie with a character voiced by pop singer Rihanna, who is writing a concept album for the film.

“For us, music is a big focus right now,” Damaschke said. “I’d expect to see more and more of it.”