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="h-screen w-100 flex flex-col items-center justify-center fixed w-full">
  <a href="#" class="hire-me--wrapper flex items-center justify-center">
    <div class="hire-me--text">
      <svg class="badge__svg" width="170" viewBox="0 0 100 100">
        <defs>
          <path id="circlePath" d="M6,50a44,44 0 1,0 88,0a44,44 0 1,0 -88,0" fill="none" stroke="#fff" stroke-dasharray="1 5"></path>
        </defs>
        <text>
          <textPath href="#circlePath">
            Hire me&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;Hire me&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;Hire me&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;Hire me&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;Hire me&nbsp;&nbsp;&nbsp;&nbsp;-
          </textPath>
        </text>
      </svg>
    </div>
    <div class="shapka">
      <img src="https://uploads-ssl.webflow.com/5eba19302c27d10056fc52f8/5ebae0f768e089030d400713_shaka.svg" />
    </div>
  </a>
  <p class="text-xs mt-8 text-gray-800">Inspired by <a href="https://www.willrust.co/" class="hover:underline">Will Rust</a> & <a href="https://codepen.io/Mamboleoo/pen/XgBvrJ" class="hover:underline">Louis Hoebregts</a></p>
</div>
<div class="fixed flex w-full left-0 bottom-0 m-4 justify-center items-center  text-xs">
  <a href="https://cbernard.dunked.com/" class="p-2 text-gray-800 hover:underline">WE</a> - <a href="https://www.instagram.com/nomadly__/" class="p-2 text-gray-800 hover:underline">IG</a> - <a href="https://www.linkedin.com/in/charlybernard/" class="p-2 text-gray-800 hover:underline">LI</a>
</div>
              
            
!

CSS

              
                body {
  font-family: "Inter";
  height: 400vh;
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.h-screen {
  background-image: linear-gradient(to top, #d299c2 0%, #fef9d7 100%);
}

.hire-me--wrapper {
  width: 200px;
  height: 200px;
  padding: 40px;
}

.hire-me--text {
  position: absolute;
  transform-style: preserve-3d;
  will-change: transform;

  svg {
    display: inline-block;
    animation: rotate 60s infinite linear;
  }
  
  textPath {
    text-transform: uppercase;
    font-size: 0.5rem;
  }
}

.shapka {
  width: 50px;
  padding-left: 10px;
  transform-style: preserve-3d;
  will-change: transform;
}

              
            
!

JS

              
                class hoverEffect {
  constructor(el) {
    this.el = el;
    this.hire_me = el.querySelector(".hire-me--text");
    this.shapka = el.querySelector(".shapka");
    this.hover = false;
    this.calculatePosition();
    this.attachEventsListener();
    this.HandleScroll();
  }

  attachEventsListener() {
    window.addEventListener("mousemove", (e) => this.onMouseMove(e));
    window.addEventListener("resize", (e) => this.calculatePosition(e));
  }

  HandleScroll() {
    gsap.to(this.hire_me, {
      scrollTrigger: {
        scrub: true
      },
      rotate: 180,
      ease: Linear.easeNone
    });
  }

  calculatePosition() {
    gsap.set(this.el, {
      x: 0,
      y: 0
    });
    const box = this.el.getBoundingClientRect();
    this.x = box.left + box.width * 0.5;
    this.y = box.top + box.height * 0.5;
    this.width = box.width;
    this.height = box.height;
  }

  onMouseMove(e) {
    let hover = false;
    let hoverArea = this.hover ? 0.7 : 0.5;
    let x = e.clientX - this.x;
    let y = e.clientY - this.y;
    let distance = Math.sqrt(x * x + y * y);
    if (distance < this.width * hoverArea) {
      hover = true;
      if (!this.hover) {
        this.hover = true;
      }
      this.onHover(e.clientX, e.clientY);
    }

    if (!hover && this.hover) {
      this.onLeave();
      this.hover = false;
    }
  }

  onHover(x, y) {
    gsap.to(this.hire_me, {
      x: (x - this.x) * 0.2,
      y: (y - this.y) * 0.2,
      duration: 0.4,
      ease: Power2.easeOut
    });
    gsap.to(this.shapka, {
      x: (x - this.x) * 0.3,
      y: (y - this.y) * 0.3,
      duration: 0.4,
      ease: Power2.easeOut
    });
  }

  onLeave() {
    gsap.to([this.shapka, this.hire_me], {
      x: 0,
      y: 0,
      duration: 0.7,
      ease: Power2.easeOut
    });
  }
}

let link = document.querySelector(".hire-me--wrapper");
new hoverEffect(link);

              
            
!
999px

Console