standards-hub / docs

A documentation template made with Nuxt UI Pro.
https://standards-hub.github.io/docs/
0 stars 0 forks source link

Hover pattern for styling #128

Open FroudeDescartes opened 1 month ago

FroudeDescartes commented 1 month ago

Image

FroudeDescartes commented 1 month ago

Yes, there are libraries that can help you create pointer effects and interactive animations similar to the one you described. While there might not be a single library that exactly matches your description out of the box, several libraries can be combined or used to achieve similar effects. Here are some libraries that might be useful:

1. GSAP (GreenSock Animation Platform)

GSAP is a powerful JavaScript library for creating high-performance animations. It can handle complex animations, including those based on user input.

import { gsap } from 'gsap';

document.addEventListener('mousemove', (e) => {
    const glow = document.querySelector('.glow');
    const x = e.clientX;
    const y = e.clientY;

    gsap.to(glow, {
        left: `${x}px`,
        top: `${y}px`,
        width: `200px`, // Example size
        height: `200px`, // Example size
        backgroundColor: `rgba(0, 255, 0, 0.6)`, // Example color
        duration: 0.1,
    });
});

2. Three.js

Three.js is a 3D library for rendering 3D graphics in the browser. It can be used for more advanced effects, including dynamic glowing effects, by leveraging shaders and 3D rendering.

3. PixiJS

PixiJS is a 2D rendering engine that can be used to create interactive graphics and effects. It's particularly good for high-performance, interactive graphics and could be used to achieve a pointer-following glow effect.

4. Hover.css

Hover.css provides a collection of CSS3-powered hover effects. While it might not have an exact match for your desired effect, it’s useful for creating interactive hover animations.

5. Anime.js

Anime.js is a lightweight animation library that can be used for creating interactive animations. It provides a powerful API for animating CSS properties, SVG, and DOM elements.

import anime from 'animejs';

document.addEventListener('mousemove', (e) => {
    const glow = document.querySelector('.glow');
    const x = e.clientX;
    const y = e.clientY;

    anime({
        targets: glow,
        left: `${x}px`,
        top: `${y}px`,
        width: [100, 200], // Example sizes
        height: [100, 200], // Example sizes
        backgroundColor: ['rgba(0, 255, 0, 0.3)', 'rgba(0, 255, 0, 0.6)'], // Example colors
        duration: 200,
        easing: 'easeOutQuad'
    });
});

Combining Libraries

You might combine libraries to achieve the exact effect you want. For example, you can use GSAP for smooth animations and CSS for initial styling, or combine Three.js for advanced graphical effects with GSAP for animations.

Each library has its strengths and is suited to different types of effects, so choose the one that best fits your project requirements.

FroudeDescartes commented 1 day ago

https://www.youtube.com/watch?v=tlv4jayQchc&list=LL&index=1