$ git show gradient-border
Rotating gradient border
A glowing gradient spins around the edge of a card, a popular highlight for a featured plan or button.
// Reanimated 4: the spin is a CSS animation, nothing else changes
import { LinearGradient } from 'expo-linear-gradient';
const spin = { from: { transform: [{ rotate: '0deg' }] }, to: { transform: [{ rotate: '360deg' }] } };
<View style={{ width: W, height: H, borderRadius: 16, overflow: 'hidden', alignItems: 'center', justifyContent: 'center' }}>
<Animated.View style={{
position: 'absolute', width: DIAG, height: DIAG,
animationName: spin,
animationDuration: '3s',
animationIterationCount: 'infinite',
animationTimingFunction: 'linear',
}}>
<LinearGradient colors={['#2F54EB', '#F25F8B', '#F5B301']} style={{ flex: 1 }} />
</Animated.View>
<View style={{ position: 'absolute', inset: 2, borderRadius: 14, backgroundColor: 'white' }}>
{children}
</View>
</View>
// DIAG = Math.ceil(Math.hypot(W, H))