React Native Spiral Animation ๐
Wednesday, December 21, 2022
Try the live demo
Scan to try on your device
Need the app?
demos
spiral
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
A mesmerizing spiral animation using Skia and mathematical functions.
What's This About?
This component creates an interactive spiral animation using logarithmic spiral mathematics and Skia rendering. It features touch-based interaction that triggers smooth transitions between different spiral states. The implementation includes dynamic radius calculations, gradient effects, and blur masking, creating a visually stunning and performant animation.
Technical Implementation
The component uses:
Skia rendering
Mathematical functions
Touch handling
Gradient effects
Blur masking
Usage
// Basic usage
<Spiral />
// With custom dimensions
<Spiral
dimensions={{
width: windowWidth,
height: windowHeight
}}
/>
// Logarithmic spiral calculation
const logarithmicSpiral = ({
angle,
index
}: {
angle: number;
index: number;
}) => {
const a = index / 4;
const k = 0.005;
return {
x: a * Math.exp(k * angle) * Math.cos(angle * index),
y: a * Math.exp(k * angle) * Math.sin(angle * index)
};
};
// Touch interaction
const touchHandler = useTouchHandler({
onStart: () => {
progress.value = withTiming(1, {
duration: 2500
});
}
});
Unlock the beauty of React Native animations
Learn Reanimated, Gesture Handler & Skia with Reanimate.dev
Feedback on Spiral
Ideas, bugs, or anything that felt off: I read every message. For anything else, write to hello@reactiive.io.
Send feedback