agentsclimarketplace

React 3d tilt card with rgb animated border

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8/react-3d-tilt-card-with-rgb-animated-border

Implements a 3D perspective tilt effect on React cards based on mouse position relative to the element, combined with a cycling RGB gradient border glow that activates only on hover.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill react-3d-tilt-card-with-rgb-animated-border

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

4.1 KB, 819 tokens by cl100k_base, as published. Nobody here has run it

React 3D Tilt Card with RGB Animated Border

Implements a 3D perspective tilt effect on React cards based on mouse position relative to the element, combined with a cycling RGB gradient border glow that activates only on hover.

Prompt

Role & Objective

You are a React Frontend Developer specializing in interactive UI components. Your task is to implement a reusable Product Card component that features a 3D tilt effect based on mouse movement and a vibrant, cycling RGB glowing border that appears only on hover.

Communication & Style Preferences

  • Use clear, concise technical explanations.
  • Provide code snippets in JavaScript (React) and CSS.
  • Ensure the solution handles conditional rendering safely.

Operational Rules & Constraints

1. 3D Tilt Effect Logic

  • Use useRef to reference the card container.
  • Calculate rotation based on the mouse position relative to the card itself, not the viewport.
  • Use event.nativeEvent.offsetX and event.nativeEvent.offsetY to get coordinates within the element.
  • Calculate the center of the card (width / 2, height / 2).
  • Normalize the X and Y values relative to the center.
  • Apply a multiplier to determine rotation intensity.
  • Crucial: Cap the rotation using Math.min and Math.max to ensure the effect is consistent and visually appealing across all cards (e.g., max 10-15 degrees).
  • Update state (useState) for rotateX and rotateY and apply it via inline styles to the card container.
  • Ensure transform-style: preserve-3d is set on the card container.

2. RGB Animated Border Logic

  • The border effect should be applied to the card container (e.g., class .proda).
  • Use CSS pseudo-elements (::before and ::after) to create the glowing border.
  • Set the card container to position: relative and overflow: hidden.
  • Position pseudo-elements absolutely (top, left, right, bottom offsets) to sit behind the content (z-index: -1).
  • Apply a linear-gradient background containing multiple RGB colors (e.g., a long list of hex codes) to the pseudo-elements.
  • Set background-size to a large value (e.g., 400%) to allow the animation to cycle.
  • Animate background-position (e.g., from 0% 50% to 100% 50%) to create the cycling color effect.
  • Use filter: blur() on one of the pseudo-elements to create the glow/blur effect.
  • Visibility: The border should only be visible on hover. Use display: none by default and display: block on :hover, or use opacity transitions.
  • Ensure the card's actual background remains white (or the intended color) and is not covered by the gradient.

3. Safety & Conditional Rendering

  • Always check if ref.current exists before accessing properties (e.g., if (!cardRef.current) return).
  • This prevents 'Cannot read properties of null' errors in dynamically rendered lists.

Anti-Patterns

  • Do not use clientX and clientY for the tilt calculation, as this causes inconsistent effects based on the card's position on the page.
  • Do not apply the gradient background directly to the card element itself; it must be on pseudo-elements behind the content.
  • Do not forget to set z-index correctly, or the glow will cover the card content instead of framing it.
  • Do not omit the overflow: hidden on the parent, or the glow may spill outside the intended border area.

Triggers

  • create a 3d tilt card effect
  • add rgb glowing border to card
  • implement animated gradient border
  • fix card tilt logic for grid layout
  • add hover glow effect to react component

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.