Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
<div class="header-us">
<div class="mbrace">Happy Tweening</div>
<div class="nav">
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
<a href="#">Home</a>
</div>
</div>
<div class="imgOwl" id="rome">
<div class="extra">
<div class="inner"></div>
</div>
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 480 40">
<path d="M0 40C137.185 40 125.676 0 240 0s103.999 40 240 40H0Z" fill="#fff"></path>
</svg>

</div>
</div>
<section>
<h1>Extra space just for demo, remove this</h1>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p>

<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p>

<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p>

<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</p>
</section>
              
            
!

CSS

              
                .header-us
{
   background:blue;
   height:80px;
   position:relative;
   width:1320px;
   top:25px;
   left:15px;
   z-index:9999999999;
   border-top-right-radius:24px;
   border-top-left-radius:24px;
}

.mbrace
{
   line-height:80px;
   position: relative; 
   left:20px;
   color:#FFF;
}

.nav{
display:flex;
justify-content:center;
align-items:center;
position:absolute;
top:30px;
left:200px;
}

.nav a
{
   margin-left:100px;
   color:#fff;
   text-decoration: none;
}

svg {
  position: absolute;
  top: 460px;
  z-index: 9999999;
  transform: scale(0.6);
  margin-bottom: -1px;
}

.imgOwl {
  width: 1320px;
  margin: 0px auto;
  height: 540px;
  background-attachment: fixed;
  clip-path: inset(0);
  position:relative;
  top:1.5%;
}




.imgOwl .extra {
  width: 100%;
  height: 100%;
}

.imgOwl .inner {
  width: 100%;
  height: 100%;
  background-image: url("https://picsum.photos/1800/1200");
  background-position: auto 100%;
  background-repeat: no-repeat;
  object-fit: cover;
  background-size: cover;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
}
              
            
!

JS

              
                const tl = gsap.timeline({ // Add timeline so we can add multiple tweens to the ScrollTrigger setup 
  scrollTrigger: {
    trigger: ".imgOwl",
    toggleActions: "restart pause reverse pause",
     pin: '.container',
    // pinSpacing:false,
    force3D: true,
    scrub: 1,
    markers: true,
    start: "clamp(top 12%)",
    end: "bottom top",
  }
});
tl.to(".imgOwl .inner", {
  backgroundPosition: "0px -550px",
  ease: "power1.out",
});

tl.to(
  ".imgOwl .extra",
  {
	
    backgroundPosition: "0px 5px",
    ease: "power1.out"
  },
  
  "<" // Start at the same time as previes tween.
);


tl.from(
  ".container", // Animate two elments at the same time
  {
     
  },
  "<" // start at the same time as previous tween
);




              
            
!
999px

Console