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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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="section" id="hero">
  <div class="hero-text">
    <h1 class="display-one text-light">Next generation industrial automation software for collaborative control</h1>
    <p class="subtitle-one text-light">We empower engineers and operators to achieve their full potential</p>
  </div>
  <div class="tint"></div>
  <div class="hero-bg">
    <img width="2048" height="1365" src="https://kelvindev.wpengine.com/wp-content/uploads/2022/04/kelvin-woman-factory-worker-2048x1365.jpg" class="hero-bg" alt="" loading="false" srcset="https://kelvindev.wpengine.com/wp-content/uploads/2022/04/kelvin-woman-factory-worker-2048x1365.jpg 2048w, https://kelvindev.wpengine.com/wp-content/uploads/2022/04/kelvin-woman-factory-worker-300x200.jpg 300w, https://kelvindev.wpengine.com/wp-content/uploads/2022/04/kelvin-woman-factory-worker-1024x683.jpg 1024w, https://kelvindev.wpengine.com/wp-content/uploads/2022/04/kelvin-woman-factory-worker-768x512.jpg 768w, https://kelvindev.wpengine.com/wp-content/uploads/2022/04/kelvin-woman-factory-worker-1536x1024.jpg 1536w" sizes="(max-width: 2048px) 100vw, 2048px">
  </div>    
</section>
              
            
!

CSS

              
                .section{
	width:100%;
	margin: 6em 0;
  padding: 0 2em;
	padding: 0 6em;

  &#hero {
    padding: 0;
    margin: 0;
    position: relative;
    height: 100vh;
    overflow: hidden;
    display: grid;
    grid-template-columns: 2fr 1fr;
    justify-content: space-between;
    grid-template-rows: auto min-content min-content;
    gap:3em;
    
    .hero-text{
        bottom: 0;
        left: 0;
        padding: 0 0 2em 2em;
        display: flex;
        flex-direction: column;
        z-index: 10;
        grid-column: 1/3;
        grid-row: 3/4;
        max-width: 75vw;
        grid-row: 3/4;
        padding: 3em;
    }
    .tint{
        background: rgba(40, 17, 105, 0.25);
        position: absolute;
        width: 100%;
        height: 100%;
        z-index: 1;
    }
    .hero-bg{
        position: absolute;
        height: 100%;
        width: 100%;
        object-fit: cover;
        z-index: -1;
        filter: grayscale(1);
        object-position: 29%;
        object-position: initial;
        transform: initial;
    }

    #hero-spiral-left{
        display: block;
        position: absolute;
        right: 0;
        top: 0;
        transform: translate(-53vw, 25vh);
        height: 125vh;
        opacity: .5;
    }
    #hero-spiral-right{
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        transform: translate(35vw, -2vh);
        height: 110vh;
        opacity: .5;
    }											 
  }
}

              
            
!

JS

              
                /**
 * Inserts and runs the animation for the Home Page Hero SVG swirls. 
 *  
 */
const heroStrings = () => {
    const heroStringsAnimate = () =>{
        const hero = document.querySelector("#hero")
        const spiralRightPath = `https://kelvindev.wpengine.com/wp-content/themes/kelvin/src/img/spiral-right.svg`
        const spiralLeftPath = `https://kelvindev.wpengine.com/wp-content/themes/kelvin/src/img/spiral-left.svg`

        // Function that runs the animation.
        const strings = () => {
          const right = document.querySelector("#hero-spiral-right")
          const left = document.querySelector("#hero-spiral-left")
          const tl = gsap.timeline()

          const strings1 = Array.from(document.querySelectorAll("#hero-spiral-right path"))
          const tl1 = gsap.timeline({
            repeat:-1,     
          })
        
          const strings2 = Array.from(document.querySelectorAll("#hero-spiral-left path"))
          const tl2 = gsap.timeline({
            repeat:-1,     
          })

          tl.from([right, left], .125, {autoAlpha:0})
        
          strings1.map(string => {
            tl1.set(string, {transformOrigin:"50% 50%"})
              .fromTo(string, .05, {autoAlpha:1, ease: "power4.inOut"}, {autoAlpha:0.3, ease: "power4.inOut"} )
              .fromTo(string, .05, {autoAlpha:0.3, ease: "power4.inOut"}, {autoAlpha:1, ease: "power4.inOut"}, "-=1")
            tl1.reverse(0)
          })
        
          strings2.map(string => {            
            tl2.set(string, {transformOrigin:"50% 50%"})
              .fromTo(string, .05, {autoAlpha:1, ease: "power4.inOut"}, {autoAlpha:0.3, ease: "power4.inOut"} )
              .fromTo(string, .05, {autoAlpha:0.3, ease: "power4.inOut"}, {autoAlpha:1, ease: "power4.inOut"}, "-=1")
            tl2.reverse(0)
          })
        }
        
        // Fetches the SVGs and places them in the DOM.
        // Then calls the animation function.
        fetch(spiralRightPath)
          .then( response => response.text() )
          .then( text => hero.innerHTML += text)
          .catch(console.error.bind(console))
          
          fetch(spiralLeftPath)
          .then( response => response.text() )
          .then( text => hero.innerHTML += text)
          .then( () => {
            strings()
          })
          .catch(console.error.bind(console));  
          
        
    }
    heroStringsAnimate()
}
heroStrings()
              
            
!
999px

Console