Mova o mouse pelo palco
Abra no computador para testar os cursores
Passe sobre os botões para ver a reação no hover
// Cursor personalizado: Ponto e anel
// Cole antes do </body> (ou no seu arquivo principal de JavaScript).
var destruirCursor = (function (alvo) {
// Só em dispositivos com mouse e sem preferência por menos movimento.
if (!matchMedia("(pointer: fine)").matches || matchMedia("(prefers-reduced-motion: reduce)").matches) return function () {};
var cor = "#ffffff";
var cor2 = "#ffffff";
var raiz = alvo === document.documentElement;
var host = raiz ? document.body : alvo;
var pos = raiz ? "fixed" : "absolute";
var fim = [];
var m = { x: 0, y: 0, v: false, hover: false };
function on(t, e, f) { t.addEventListener(e, f); fim.push(function () { t.removeEventListener(e, f); }); }
function el(css) {
var d = document.createElement("div");
d.setAttribute("aria-hidden", "true");
d.style.cssText = "position:" + pos + ";left:0;top:0;pointer-events:none;z-index:2147483647;opacity:0;will-change:transform;transition:opacity .2s;" + css;
host.appendChild(d);
fim.push(function () { d.remove(); });
return d;
}
function loop(f) {
var id, t0 = 0;
function q(t) { id = requestAnimationFrame(q); f(t, Math.min(0.05, (t - t0) / 1000 || 0.016)); t0 = t; }
id = requestAnimationFrame(q);
fim.push(function () { cancelAnimationFrame(id); });
}
// Esconde o cursor nativo.
var st = document.createElement("style");
st.textContent = (raiz ? "html,html *" : "[data-cursor-palco],[data-cursor-palco] *") + "{cursor:none!important}";
document.head.appendChild(st);
fim.push(function () { st.remove(); });
on(raiz ? document : alvo, "pointermove", function (e) {
if (e.pointerType !== "mouse") return;
var r = raiz ? { left: 0, top: 0 } : alvo.getBoundingClientRect();
m.x = e.clientX - r.left; m.y = e.clientY - r.top; m.v = true;
m.hover = !!(e.target.closest && e.target.closest("a,button,[data-hover]"));
});
on(raiz ? document.documentElement : alvo, "pointerleave", function () { m.v = false; });
var anel = el("width:36px;height:36px;margin:-18px 0 0 -18px;border:1.5px solid " + cor + ";border-radius:50%");
var ponto = el("width:6px;height:6px;margin:-3px 0 0 -3px;background:" + cor + ";border-radius:50%");
var x = 0, y = 0, s = 1, ini = false;
loop(function (t, dt) {
if (!ini && m.v) { x = m.x; y = m.y; ini = true; }
var k = 1 - Math.pow(1 - 0.14, dt * 60);
x += (m.x - x) * k; y += (m.y - y) * k;
s += ((m.hover ? 1.9 : 1) - s) * 0.2;
ponto.style.transform = "translate(" + m.x + "px," + m.y + "px)";
anel.style.transform = "translate(" + x + "px," + y + "px) scale(" + s + ")";
anel.style.opacity = ponto.style.opacity = m.v ? 1 : 0;
});
return function () { fim.forEach(function (f) { f(); }); };
})(document.documentElement);
// Para remover o cursor depois: destruirCursor();Um ponto preciso e um anel que chega com atraso e cresce sobre links e botões.
Você pode ver como ela funciona, mas para usar é preciso ter uma conta.