Line Draw Comparison Trend Chart
A dark curve draws toward month 6 while a hollow marker trails the head, catches up and bounces at the end. A red comparison curve dips and rebounds, filled areas reveal left to right, then labels fade in. Shared core, SVG on React Native.
export function Example() {
const progress = useSharedValue(0);
…
Agent prompt
Add the Now In Code component "line-draw-comparison-trend-chart" to this project. The full source is attached at the end of this prompt. Put the files under components/line-draw-comparison-trend-chart/, install the listed dependencies with `npx expo install`, and render it on a route I can open. Keep the timing and easing values documented in the source comments. Replace the sample copy and artwork with content from my app, or leave placeholders and list what I still need to supply. === Source files are attached here for paid plans ===
Details
- Platforms
- iOS, Android
- Requires
- Expo SDK 54+
- Access
- Pro
- Updated
- 27 Oct 2026
- License
- Unlimited commercial projects
- Original design
- @mobbin on X
Are you the designer? Ask us to change or remove this.
Add pieces from the terminal or let your agent fetch them. Until then, Copy prompt does the same job. Docs
What it does
A light onboarding card that compares two weight-trend lines over six months. A dot travels along a black line that falls gradually, and the line head pulls ahead of it on the downhill stretch. A red line draws alongside, and a gray area under the black line and a faint pink area under the red one reveal left to right. The end dot pops slightly larger and settles. The title, a month label, a badge and two lines of body text rise in with a fade. Replay controls and a scrub bar exist in the HTML preview.
How it's built
There is no chart library. A shared JavaScript core stores a hand-traced curve, builds a monotone cubic interpolation with an arc-length table, and outputs ready SVG path strings for the truncated lines and fill polygons at any time t. The React Native component only renders them with react-native-svg, driven by a requestAnimationFrame clock. The black line, red line, dot and fill edge each follow their own timing track, which is what lets the head lead the dot. Text entrances use eased opacity plus a short upward shift.
Good for
- Onboarding screens that show a projected result such as weight, savings or progress
- Before-and-after or with-and-without comparison charts
- A short reveal animation for a hero chart on a results screen
Dependencies
react-native-svgreact-native