Comcast Corp., the parent of Universal Pictures, agreed to buy DreamWorks Animation SKG Inc. in a deal valued at $3.8 billion, building on the studio’s film and TV franchises by adding characters like Shrek as well as a U.S.-based production house.

Comcast will pay $41 a share in cash for the animation studio, according to a statement Thursday. DreamWorks Animation co-founder and Chief Executive Officer Jeffrey Katzenberg will mostly step aside.

Chris Meledandri, the founder of Universal Pictures’ Illumination Entertainment, will run the combined animation business, Comcast said.

Buying the maker of the Shrek and Kung Fu Panda films will bolster Comcast’s children’s lineup in theaters and add online assets like AwesomenessTV, which targets millennials on YouTube.