Refractive Glass Lens Card Carousel
A rounded photo card sits over a blurred, enlarged copy of the photo. Dragging refracts the cards through an ellipse lens larger than the screen, magnifying toward the edges and splitting color, then snaps to the nearest card in a loop. WebGL on web.
export function Example() {
const progress = useSharedValue(0);
…
Agent prompt
Add the Now In Code component "refractive-glass-lens-card-carousel" to this project. The full source is attached at the end of this prompt. Put the files under components/refractive-glass-lens-card-carousel/, install the listed dependencies with `npx expo install`, and render it on a route I can open. Keep the timing and easing values documented in the source comments. Replace the sample copy and artwork with content from my app, or leave placeholders and list what I still need to supply. === Source files are attached here for paid plans ===
Details
- Platforms
- iOS, Android
- Requires
- Expo SDK 54+
- Access
- Pro
- Updated
- 2 Nov 2026
- License
- Unlimited commercial projects
- Original design
- @rit3zh on X
Are you the designer? Ask us to change or remove this.
Add pieces from the terminal or let your agent fetch them. Until then, Copy prompt does the same job. Docs
What it does
A dark event-invitation screen with one large rounded card in the centre and the edges of its neighbours showing. Dragging sideways passes the whole card stage through an elliptical glass lens larger than the screen. Magnification grows toward the edges, curving the card outlines inward, and the lens pulls rainbow fringes onto edges and text. The card shrinks by up to a quarter with scroll speed. On release the carousel snaps to the nearest card by position or fling and loops without end. The page background is a darkened, enlarged blur of the current card's photo and cross-fades as you move, and once the card settles the lens clears over it.
How it's built
The lens is an SkSL runtime shader applied to a Skia group layer holding the card stage, with a 12-sample chromatic split. Card transforms, images and shader uniforms come from Reanimated derived values, and a frame callback drives either a demo replay or the live engine. The card face blur is built from view snapshots taken with makeImageFromView and blurred in two offscreen passes, and a gesture handler Pan reports the velocity used for the fling. Native glass buttons come from expo-glass-effect, and the card text fades use a linear gradient.
Good for
- An event, ticket or invite carousel in a social app
- A featured-item picker where drag and fling should feel physical
- Adding a refraction layer over any content stage, not only cards
Dependencies
@shopify/react-native-skiaexpo-glass-effectexpo-linear-gradientreact-native-gesture-handlerreact-native-reanimatedreact-native-svgreact-native