<h1>gsap.quickTo() mouse follower</h1>

<div class="ball"></div>
body {
  background-color: black;
  font-family: "Signika Negative", sans-serif;
  color: white;
  text-align: center;
}

.ball {
  width: 50px;
  height: 50px;
  position: fixed;
  top: 0;
  left: 0;
  border: 3px solid dodgerblue;
  border-radius: 50%;
  pointer-events: none;
}
// requires GSAP 3.10.0 or later

gsap.set(".ball", {xPercent: -50, yPercent: -50});

let xTo = gsap.quickTo(".ball", "x", {duration: 0.6, ease: "power3"}),
    yTo = gsap.quickTo(".ball", "y", {duration: 0.6, ease: "power3"});

window.addEventListener("mousemove", e => {
  xTo(e.pageX);
  yTo(e.pageY);
});

// older quickSetter version: https://codepen.io/GreenSock/pen/WNNNBpo

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://assets.codepen.io/16327/gsap-latest-beta.min.js?v=3.10.1a