"use client"; import * as React from "react"; import { motion } from "framer-motion"; import { useInViewOnce } from "./useInViewOnce"; const DIGITS = "0110100110010110011010011001011001101001"; const DURATION = 0.95; const EASE = [0.65, 0, 0.35, 1] as const; /** * BitWipe: reveals its content from left to right behind a narrow column of * binary digits, as if the text were being written out bit by bit. The content * keeps its place the whole time, so nothing reflows. * * Visibility is observed on the outer wrapper: the inner element is clipped away * completely at first, and a fully clipped element never counts as "in view". */ export const BitWipe: React.FC<{ children: React.ReactNode; className?: string; delay?: number; /** Colour of the digit column: dark on light surfaces, light on dark ones. */ tone?: "dark" | "light"; }> = ({ children, className = "", delay = 0, tone = "dark" }) => { const { ref, seen, still } = useInViewOnce(0.35); const open = seen || still; return (
{children} {seen && !still && ( )}
); };