Menu

I Built a 8.7KB React Animation Library (120+ FPS) on top of GSAP
๐Ÿ–ผ๏ธ

I Built a 8.7KB React Animation Library (120+ FPS) on top of GSAP

DEV CommunityยทYousef Zedanยท6 months ago
#lTlSnh64
#implementation#gsap#npm#proximity#engine
Reading 0:00
15s threshold

After weeks of development, I'm excited to share ZProximity Engine - a React library for creating proximity-based animations.

๐ŸŽฏ The Problem

Creating magnetic cursors, hover effects, and scroll animations in React usually requires:

Manual event listeners

Complex trigonometry

Performance optimization headaches

โœจ The Solution

ZProximity Engine abstracts all of this into a simple API:

import { Proximity } from ' z-proximity-engine ' ;

< Proximity preset = "scale-magnetic" reach = { 2 } > < div className = "prox-item" > Hover me! </ div > </ Proximity >

Enter fullscreen mode

Exit fullscreen mode

๐Ÿ—๏ธ Technical Highlights

1. Zero Re-renders

Uses GSAP's ticker system instead of React's render cycle.

2. Smart Batching

Pre-caches quickTo functions on mount - no property lookups per frame.

3. Spatial Grid

150px spatial hash grid - only checks nearby elements, not all 100+.

4.โ€ฆ

Continue reading โ€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.