Scooping up Shrek and Kung Fu Panda in a direct bid to compete with The Walt Disney Co., New York-based NBCUniversal Inc. has agreed to acquire Glendale, California-based DreamWorks Animation in a deal valued at $3.8 billion.

Davis Polk & Wardwell represented NBCUniversal and cable giant Comcast, which bought a controlling stake in NBCUniversal in 2010.