reveal-hover-effect
Qué hace
Esta skill construye un efecto de paso del ratón sobre una imagen, en el que un círculo suave alrededor del puntero muestra una segunda imagen alineada. Es para diseñadores y desarrolladores que hacen vistas de detalle de producto, de antes y después o de comparación de materiales.
Cuándo usarla
- ✓Cuando quieres que los visitantes pasen el ratón sobre una imagen y vean una versión en color o con textura.
- ✓Cuando necesitas una comparación de antes y después que siga al ratón.
- ✓Cuando una página de producto debe mostrar una vista de rayos X o de material al pasar el ratón.
Link de la skill
https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/reveal-hover-effect/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Quiero que los visitantes pasen el ratón sobre la foto de mi producto y vean una versión en color dentro de un círculo suave que siga al cursor.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
El agente apila dos imágenes del mismo tamaño, pone una máscara radial con bordes difuminados sobre la superior y la mueve hacia el puntero con una animación suave. Cuando el puntero sale, el círculo se encoge para no dejar nada detrás.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Reveal Hover Effect
Core Contract
- Prepare two images with identical dimensions, composition, crop, and focal point.
- Keep the base image fully visible.
- Stack the reveal image directly above it.
- Apply a feathered radial
mask-imageto the reveal image. - Track pointer coordinates in the component's local coordinate space.
- Ease the rendered position toward the raw pointer with
requestAnimationFrame. - Collapse the mask on pointer exit; never leave a stale spotlight behind.
Default to CSS masks instead of generating a canvas data URL every frame. The CSS version preserves the same look with less allocation and simpler cleanup.
Motion Defaults
- Desktop spotlight radius:
260px. - Compact spotlight radius:
140pxto220px. - Pointer easing:
0.1. - Radius easing:
0.14. - Mask stops:
0%: alpha140%: alpha160%: alpha0.7575%: alpha0.488%: alpha0.12100%: alpha0
- Initial state: base image only.
- Exit state: radius eases back to
0. - Cursor: keep the native cursor unless the design explicitly needs a custom one.
Markup
Use real images so loading, intrinsic sizing, and accessibility remain predictable.
<figure class="reveal-hover" data-reveal-hover data-reveal-radius="260">
<img
class="reveal-hover__image reveal-hover__image--base"
src="/images/product-linework.webp"
alt="Sculpted product shown in a pale linework treatment"
width="1600"
height="1000"
decoding="async"
/>
<img
class="reveal-hover__image reveal-hover__image--overlay"
src="/images/product-color.webp"
alt=""
width="1600"
height="1000"
decoding="async"
aria-hidden="true"
/>
</figure>
Keep the overlay decorative when both images communicate the same subject. If the comparison carries unique information, provide visible labels or a separate accessible description.
CSS Mask
.reveal-hover {
--reveal-x: 50%;
--reveal-y: 50%;
--reveal-radius: 0px;
position: relative;
overflow: clip;
isolation: isolate;
margin: 0;
background: #f3f1ec;
contain: paint;
}
.reveal-hover__image {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
.reveal-hover__image--base {
position: relative;
z-index: 0;
}
.reveal-hover__image--overlay {
position: absolute;
z-index: 1;
inset: 0;
pointer-events: none;
-webkit-mask-image: radial-gradient(
circle var(--reveal-radius) at var(--reveal-x) var(--reveal-y),
rgb(0 0 0 / 1) 0%,
rgb(0 0 0 / 1) 40%,
rgb(0 0 0 / 0.75) 60%,
rgb(0 0 0 / 0.4) 75%,
rgb(0 0 0 / 0.12) 88%,
transparent 100%
);
mask-image: radial-gradient(
circle var(--reveal-radius) at var(--reveal-x) var(--reveal-y),
rgb(0 0 0 / 1) 0%,
rgb(0 0 0 / 1) 40%,
rgb(0 0 0 / 0.75) 60%,
rgb(0 0 0 / 0.4) 75%,
rgb(0 0 0 / 0.12) 88%,
transparent 100%
);
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
will-change: -webkit-mask-image, mask-image;
}
@media (hover: none), (pointer: coarse) {
.reveal-hover__image--overlay {
display: none;
}
}
Keep object-fit and object-position identical on both layers. A one-pixel mismatch becomes obvious inside the spotlight.
Eased Pointer Tracking
Run the animation loop only while values are changing. Convert clientX and clientY with getBoundingClientRect(); page coordinates will drift after scroll.
function initRevealHover(element) {
const overlay = element.querySelector(".reveal-hover__image--overlay");
const finePointer = window.matchMedia("(hover: hover) and (pointer: fine)");
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
if (!overlay || !finePointer.matches) return () => {};
const state = {
x: 0,
y: 0,
targetX: 0,
targetY: 0,
radius: 0,
targetRadius: 0,
clientX: 0,
clientY: 0,
inside: false,
frame: 0,
};
const getRadius = () => {
const requested = Number.parseFloat(element.dataset.revealRadius);
if (Number.isFinite(requested)) return requested;
return Math.min(260, Math.max(140, element.clientWidth * 0.22));
};
const updateTarget = (clientX, clientY) => {
const rect = element.getBoundingClientRect();
state.clientX = clientX;
state.clientY = clientY;
state.targetX = clientX - rect.left;
state.targetY = clientY - rect.top;
};
const schedule = () => {
if (!state.
Preguntas frecuentes
¿Las dos imágenes tienen que coincidir?
Sí. La skill exige las mismas dimensiones, el mismo recorte y el mismo punto focal para que queden alineadas.
¿Dibuja en un lienzo en cada fotograma?
No. Por defecto usa máscaras de CSS, que son más ligeras y más fáciles de limpiar.
¿Oculta el cursor normal?
No. Mantiene el cursor nativo, salvo que el diseño requiera uno personalizado.
Detalles
Descripción original del autor
Build cursor-following spotlight reveals that expose a second aligned image through a soft radial mask. Use for hover-to-color, before-and-after, x-ray, material, texture, product-detail, and illustrated hero effects where a desaturated or embossed base image should remain visible while another treatment follows an eased pointer.
repo: MengTo/Skills
Popularidad
- Estrellas en GitHub
- 7,2 mil
- Posición en el ranking
- #13461
- Licencia
- MIT
- Actualizada
- 1/11/2026
Comentarios
- …
Más skills de este repositorio
3d-cloth-material
7,2 milAyuda a tu agente a crear tela tejida realista en Three.js, con el entramado del hilo, un brillo suave, pliegues naturales, dobladillos y costuras.
3d-falling-leaves
7,2 milAyuda a tu agente a añadir hojas que caen de forma realista a una escena 3D, con hojas que giran, se dejan llevar por el viento y se reciclan al moverse la cámara.
3d-four-seasons
7,2 milAyuda a tu agente a añadir los aspectos de primavera, verano, otoño e invierno a una escena 3D, cambiando la vegetación, la luz, el cielo y la nieve sin reconstruirla.
3d-high-poly-models
7,2 milAyuda a tu agente a construir modelos 3D detallados con formas suaves y bordes creíbles, y después preparar versiones más ligeras que funcionen bien en la web.
Skills parecidas
canvas
394 milPermite que tu agente muestre un widget visual alojado en un panel de Mac conectado y después ocultar el panel o moverlo a otra página.
control-ui
394 milAyuda a tu agente a organizar y resolver problemas de la interfaz de control de OpenClaw, incluidas las sesiones, los paneles y las Gateways conectadas.
diagram-maker
394 milAyuda a tu agente a crear diagramas claros en SVG, HTML o Excalidraw editable para procesos, arquitectura de sistemas y bocetos de pizarra.