Shrinking Sticky Header

Hello Guys,

I’m looking for a way to shrink my header while scrolling. Basically the header should have more info in the hero section than when scrolling, but not disappear completely.

here is an example: https://www.editorx.com/inspiration/type/header-scroll-effects-websites

Thanks to anyone who can help me!

PS: Gladly also as code