import {useEffect, useRef, useState} from 'react'; import type {CSSProperties} from 'react'; import {Molecule} from './Molecule'; import {useMotion} from './Motion'; import type {ProteinCase} from './types'; type Direction='joint'|'design'|'describe'; const captions={joint:'Two supervised directions. Connected through shared parameters.',design:'Functional language → amino-acid sequence',describe:'Amino-acid sequence → functional language'}; export function HeroScene({protein}:{protein:ProteinCase}){ const [direction,setDirection]=useState('joint'); const [visible,setVisible]=useState(false); const host=useRef(null); const {enabled}=useMotion(); useEffect(()=>{ const observer=new IntersectionObserver(([entry])=>setVisible(entry.isIntersecting),{threshold:.08}); if(host.current)observer.observe(host.current); const visibility=()=>{if(document.hidden)setVisible(false);else if(host.current){const r=host.current.getBoundingClientRect();setVisible(r.bottom>0&&r.top{observer.disconnect();document.removeEventListener('visibilitychange',visibility);}; },[]); const running=enabled&&visible; return
PROTEIN–LANGUAGE INTERFACE DUAL LEARNING
{([['joint','Learn together'],['design','Design →'],['describe','← Describe']] as [Direction,string][]).map(([value,label])=>)}

{captions[direction]}

DE2 · predicted fold · drag to rotateExplore protein ↗
; }