Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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

              
                <section class="about-hero">
  <div class="about-hero__content py-32 min-h-3/4-screen flex items-center">
    <header class="flex flex-col justify-center w-full">
      <div class="about-hero__marquee w-full">
        <div class="about-hero__marquee-row" role="marquee">
          <div class="about-hero__marquee-item">
            <span class="about-hero__marquee-item-text">Bespoke Designer</span>
          </div>
          <div class="about-hero__marquee-item about-hero__marquee-item--stroke">
            <span class="about-hero__marquee-item-text">Web Developer</span>
          </div>
          <div class="about-hero__marquee-item">
            <span class="about-hero__marquee-item-text">Awwwards Judge</span>
          </div>
          <div class="about-hero__marquee-item about-hero__marquee-item--stroke">
            <span class="about-hero__marquee-item-text">Digital Artist</span>
          </div>
          <div class="about-hero__marquee-item">
            <span class="about-hero__marquee-item-text">Storyteller</span>
          </div>
          <div class="about-hero__marquee-item about-hero__marquee-item--stroke">
            <span class="about-hero__marquee-item-text">Dribbbler</span>
          </div>
        </div>
      </div>
    </header>
  </div>
</section>
              
            
!

CSS

              
                .about-hero {
  display: block; 
    &__marquee {
        overflow: hidden;
    }

    &__marquee-row {
        display: flex;
        position: relative;
        text-align: center;
        white-space: nowrap;
    }

    &__marquee-item {
        position: relative;
        line-height: 100%;
        font-size: 3.75vw;
        padding: 48px 0;
        text-transform: uppercase; 

        &-text {
            position: relative;
            display: inline-block;
            z-index: 1;
            padding: 0 64px;
            font-size: clamp(24px, calc(1.5rem + ((1vw - 7.68px) * 1.0417)), 1.875vw);
        }

        &--stroke {
            color: transparent;
            text-shadow: none;
            -webkit-text-stroke: 2px rgba(0, 0, 0, 0.2);
        }
    }
}
              
            
!

JS

              
                function initMarquee() {
  
  // Kill other animations
  animations.forEach(animation => animation.progress(0).kill())

  // Marquee speed (pixels per second)
  let velocity = 150;
  
  let offset = 0
  let itemWidth = 0
  let rowWidth = 0
  
  let marqueeItems = gsap.utils.toArray('.about-hero__marquee-item')

  // Calculate row width
  marqueeItems.forEach(e => {
    rowWidth += e.getBoundingClientRect().width
  })
  
  // Animation Loop
  marqueeItems.forEach((e, i) => {

    // Reset item positions
    gsap.set(e, {x: 0})
    
    itemWidth = e.getBoundingClientRect().width
    
    let tl = new gsap.timeline({ repeat: -1 });
    
    // Animate item to end of row
    tl.to(e, {
      ease: "none",
      duration: ((rowWidth - offset - itemWidth) / velocity),
      x: (rowWidth - offset - itemWidth),
    });
        
    // Send item to beginning
    tl.to(e, {
      ease: "none",
      duration: 0,
      x: ((offset + itemWidth) * -1)
    })
    
    // Animate to original position
    tl.to(e, {
      ease: "none",
      duration: ((offset + itemWidth) / velocity),
      x: 0
    })
    
    // Increment offset
    offset += itemWidth
    
    animations.push(tl)
  })
}

let animations = []

initMarquee()
 
var timer
function handleResize() {
  clearTimeout(timer)
  timer = setTimeout(initMarquee, 500)
}

window.addEventListener('resize', handleResize)
              
            
!
999px

Console