Pen Settings



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


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


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.


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.


                <div id="target">
  <img src="" />
	<h1>SECTION 1</h1>
	<h1>SECTION 2</h1>
	<h1>SECTION 3</h1>
	<h1>SECTION 4</h1>
	<h1>SECTION 5</h1>
	<h1>SECTION 6</h1>
	<h1>SECTION 7</h1>
	<h1>SECTION 8</h1>
	<h1>SECTION 9</h1>


  overscroll-behavior: none;
  border-bottom:1px solid #636363;
  width: 15%;
  position: relative;
  height: 50vh;
  border-bottom:1px solid #636363;
  width: 15%;
  line-height: 1;
  color: #fff;
  margin: 0 0 0 20px;
#target {
  position: fixed;
  right: 0;
  top: 0;
  background: #000;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
#target img {
  height: 100%;
  /* will-change: transform; */


                // This effect lets you zoom in on a particular spot on the target - you define the scale and the origin as an Array of x/y normalized values.
// Like {scale: 3, origin: [0.25, 0.8]} will zoom in on the spot that's 25% from the left, and 80% from the top of the element/image.
// It will return an animation that controls the xPercent, yPercent, and scale (as well as any other values you pass in, like a normal tween)
// It won't let the edges collapse toward the center. It's best to put the element into a container that has overflow: hidden.
  name: "zoom",
  effect: (targets, config) => {
    const vars = {transformOrigin: "0px 0px", ...config},
          { scale, origin } = config,
          clamp = gsap.utils.clamp(-100 * (scale - 1), 0);
    delete vars.origin;
    vars.xPercent = clamp((0.5 - origin[0] * scale) * 100);
    vars.yPercent = clamp((0.5 - origin[1] * scale) * 100);
    vars.overwrite = "auto";
    return, vars);
  extendTimeline: true,
  defaults: {origin: [0.5, 0.5], scale: 2}

// for each section, we define the zoom data here
const zoomData = [
  {scale: 1, origin: [0.5, 0.5]},
  {scale: 3, origin: [0.75, 1]},
  {scale: 2, origin: [0.5, 0.5]},
  {scale: 3, origin: [0.25, 0]},
  {scale: 2, origin: [0.5, 0.5]},
  {scale: 3, origin: [0.25, 1]},
  {scale: 2, origin: [0.5, 0.5]},
  {scale: 3, origin: [0.25, 0.3]},
  {scale: 1, origin: [0.5, 0.5]}
  // now create the timeline that we'll scrub
  tl = gsap.timeline({
    scrollTrigger: {
      start: 0, // start from the top
      end: "+=" + ((zoomData.length - 1) * 100) + "%", // each section is 100% of the viewport height
      scrub: 0.5 // take 0.5 to catch up to scroll position

        // set the starting state
gsap.effects.zoom("#target", {scale: zoomData[0].scale, origin: zoomData[0].origin, duration: 0});

// now loop through subsequent sections and create the ScrollTrigger accordingly.
zoomData.slice(1).forEach(data => {
  tl.zoom("#target img", {
    scale: data.scale,
    origin: data.origin,
    force3D: false,
    ease: "power1.inOut"