Record Button Animation with Skia 🎤
Wednesday, May 15, 2024
Scan to try on your device
Need the app?
skia
demos
record-button
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
A scrollable interface with an animated record button and snapping behavior.
What's This About?
This component creates an interactive record button interface with sophisticated scroll animations. As users scroll, the interface smoothly transitions between states, featuring border radius animations and a custom record button. The implementation includes scroll-based interpolation, snapping behavior, and precise animation timing, making it suitable for media recording applications.
Technical Implementation
The component uses:
Scroll offset tracking
Interpolated animations
Snapping behavior
Border radius transitions
Custom button styling
Usage
// Basic usage
<RecordButton />;
// Button configuration
const ButtonConfig = {
width: 90,
height: 40,
radius: 20,
strokeWidth: 1,
color: '#ed4e3c',
};
// Scroll interpolation
const progress = useDerivedValue(() => {
return interpolate(
scrollOffset.value,
[WindowHeight * 0.08, WindowHeight * 0.2],
[0, 1],
Extrapolation.CLAMP
);
});
// Border radius animation
const rMainPageStyle = useAnimatedStyle(() => {
return {
borderCurve: 'continuous',
borderRadius: interpolate(
scrollOffset.value,
[0, 0.1],
[0, 35],
Extrapolation.CLAMP
),
};
});
Unlock the beauty of React Native animations
Learn Reanimated, Gesture Handler & Skia with Reanimate.dev
Feedback on Record Button
Ideas, bugs, or anything that felt off: I read every message. For anything else, write to hello@reactiive.io.
Send feedback