Skip to content

HexagramVisual

The HexagramVisual component renders I Ching hexagrams using the traditional six-line format. It supports changing lines, animated transitions, and multiple sizes.


Hexagrams are composed of two line types:

Yang (solid)
Yin (broken)
LineSymbolMeaning
Yang━━━━━Creative, active, light, masculine
Yin━━ ━━Receptive, passive, dark, feminine

tiny
small
medium
large
SizeLine WidthLine HeightGapUsage
tiny28px2px3pxList items, badges
small40px3px3pxCards, thumbnails
medium60px4px6pxDefault, detail views
large80px5px8pxHero, focus states

When a hexagram has changing lines, they’re highlighted in gold with optional indicator dots.

<HexagramVisual
hexagramNumber={1}
changingLines={[2, 4]} // Lines 2 and 4 are changing
showChangingDots={true}
/>

The component supports smooth animations when transitioning between hexagrams.

Animated transition
<HexagramVisual
hexagramNumber={1}
futureHexagramNumber={2}
changingLines={[2]}
animationProgress={animatedValue}
animated={true}
/>

The animation:

  1. Current line shrinks to the right
  2. Future line grows from the right
  3. Changing dots fade out during transition

PropTypeDefaultDescription
hexagramNumbernumber-Hexagram number (1-64)
size'tiny' | 'small' | 'medium' | 'large''medium'Visual size
changingLinesnumber[][]Line positions that are changing (1-6)
showChangingDotsbooleanfalseShow indicator dots
animatedbooleanfalseEnable animations
futureHexagramNumbernumber-Target hexagram for animation
animationProgressAnimated.Value-Animation progress (0-1)
// Line colors
theme.colors.textPrimary // Standard lines
theme.colors.goldPrimary // Changing lines
// Geometry
theme.radius.subtle // Line border radius (1px)

  • Use appropriate sizes for context (tiny for lists, large for focus)
  • Show changing lines when they’re relevant to the reading
  • Use animation for meaningful transitions
  • Maintain consistent sizing across related views
  • Mix different sizes in the same context
  • Animate without purpose
  • Show changing dots without changing lines
  • Use hexagram visuals purely decoratively

import { HexagramVisual } from '@synchronicity/react-native';
import { useRef, useEffect } from 'react';
import { Animated } from 'react-native';
function ReadingTransition({ currentHex, futureHex, changingLines }) {
const animationProgress = useRef(new Animated.Value(0)).current;
useEffect(() => {
// Animate from current to future hexagram
Animated.timing(animationProgress, {
toValue: 1,
duration: 1000,
useNativeDriver: true,
}).start();
}, [futureHex]);
return (
<View style={styles.container}>
<Text style={styles.title}>Your Reading</Text>
<HexagramVisual
hexagramNumber={currentHex}
futureHexagramNumber={futureHex}
changingLines={changingLines}
animationProgress={animationProgress}
showChangingDots={true}
size="large"
animated
/>
<View style={styles.legend}>
<View style={styles.legendItem}>
<View style={styles.normalLine} />
<Text>Static line</Text>
</View>
<View style={styles.legendItem}>
<View style={styles.changingLine} />
<Text>Changing line</Text>
</View>
</View>
</View>
);
}