Steddy Graph Interaction with Skia and Reanimated
Wednesday, November 8, 2023
demos
steddy-graph-interaction
An ongoing collection of React Native animations crafted with Reanimated, Gesture Handler, and Skia.
TypeScript
3.2k
296
An interactive graph component with difficulty selection and score visualization.
What's This About?
This component creates an interactive graph visualization with a segmented control for different difficulty levels. It features smooth transitions between different score sets, customizable graph dimensions, and responsive layout. The implementation includes difficulty selection controls and a dynamic graph display, making it perfect for data visualization with interactive controls.
Technical Implementation
The component uses:
Segmented controls
Graph rendering
Score mapping
Window dimensions
Custom fonts
Usage
// Basic usage
<SteddyGraphInteraction />
// Graph component
<Graph
scores={scores}
canvasHeight={200}
canvasWidth={windowWidth}
padding={50}
maxValue={100}
lineScore={70}
style={{ marginTop: 20 }}
/>
// Segmented control
<SegmentedControl
data={['Light', 'Standard', 'Pro']}
onPress={(item) => {
setSelectedDifficulty(item);
}}
width={windowWidth - 30}
height={56}
selected={difficulty}
/>
// Score mapping
const ScoringMap = {
Light: LIGHT_GRAPH_SCORES,
Standard: STANDARD_GRAPH_SCORES,
Pro: PRO_GRAPH_SCORES
};
// Window dimensions
const { width: windowWidth } = useWindowDimensions();
// Score calculation
const scores = useMemo(() => {
return ScoringMap[difficulty];
}, [difficulty]);
Unlock the beauty of React Native animations
Learn Reanimated, Gesture Handler & Skia with Reanimate.dev
Feedback on Steddy Graph Interaction
Ideas, bugs, or anything that felt off: I read every message. For anything else, write to hello@reactiive.io.
Send feedback