Installation
npx kinetic-ui-cli@latest add activity-heatmapMechanics
This component elevates the classic GitHub contribution graph using Framer Motion for interactive physics:
- Spotlight Hover: By tracking the
hoveredCellcoordinate(r, c), we can calculate the Euclidean distance to every other cell. Cells within a radius of 2.5 receive a slight scale boost, creating a localized magnifying-glass effect around the cursor. - Click Ripples: On click, we log the
rippleOriginand the exact timestamp. We recalculate the distance from the click origin to all cells, mapping that distance to an animationdelay. This creates a fluid shockwave traveling outward through the grid.
Usage Guide
1. Import the Component
Import the component into your React or Next.js page:
import { ActivityHeatmap } from "@/components/creative/activity-heatmap";
2. Implementation Example
Render the component and customize its behavior by passing props:
import { ActivityHeatmap } from "@/components/creative/activity-heatmap";
export default function Example() {
return (
<div className="w-full flex items-center justify-center p-8">
<ActivityHeatmap
rows{10}
cols{10}
/>
</div>
);
}