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

              
                <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Red+Hat+Display:ital,wght@0,300..900;1,300..900&display=swap" rel="stylesheet">

<div class="trigger">
<section class="zoom-in">
	<div>
		<h2>Zoom In</h2>
		<p><a href="#anchor">Anchor</a></p>
	</div>
</section>
<section class="zoom-out">
	<div>
		<h2>ZOOM OUT</h2>
	</div>
</section>
  
  </div>
<section class="normie" id="anchor">
	<div class="container" data-aos="fade">
		<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
		tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
		quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
		consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
		cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
		proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

		<div class="image"><img src="https://placehold.co/600x400" alt=""></div>
	</div>
</section>
              
            
!

CSS

              
                $md: 992px;

body{
	font-family: "Red Hat Display", sans-serif;
	font-optical-sizing: auto;
	font-weight: 300;
  margin: 0;
}

section{
	// padding: 50px 0;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow:hidden;
  text-align:center;
  h2{
     font-weight: 700;
     font-size:76px;
     text-transform:uppercase;
  }
	&.zoom-in{
		background: pink;
	}
	&.zoom-out{
		background: red;
    visibility: hidden;
	}
	@media only screen and (min-width: $md) {
		// padding: 150px 0;
	}
	.image{
		// margin-top: 80px;
    text-align:center;
	}
}

.trigger{
  display: grid; 
grid-template-columns: 1fr; 
grid-template-rows: 1fr; 
grid-column-gap: 0px;
grid-row-gap: 0px; 
align-items: center;
justify-items: center;
> * { grid-area: 1 / 1 / 2 / 2; 
  width: 100%;} 
}
              
            
!

JS

              
                const tl = gsap.timeline({
  // scrollTrigger: {
  //       trigger: ".trigger",
  //       pin: true,
  //       end: `+=${innerHeight * 2}`, 
  //       scrub: 1,
  //   markers: true,
  //   }
});
tl.to(".zoom-in h2", {
  scale: 2000,
  // stagger: 0.25, // There is just one h2, so there is nohting to stagger.
  duration: 1
});
tl.set(".zoom-out", { // Make the red section visable when the pink section is done
  autoAlpha: 1,
})
tl.from(".zoom-out h2", {
  scale: 2000,
  // stagger: 0.25, 
  duration: 0.5
});
tl.add(() => {}, "+=1") // Add a pause to the end of the timeline to do nothing at the end for a moment

// Create an helper to easily debug the animation. This premium plugin you can just freely use on Codepen 🎉
GSDevTools.create({ animation: tl });

              
            
!
999px

Console