HEL-823 A3: days/memories, creation wizard, settings pages on cef8ae5 (author delivery, 15 modified + 1 handoff per CHANGES-HEL-823.json)
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
multica-agent
parent
cef8ae5581
commit
0bc4a9e68e
@@ -11,14 +11,28 @@ export interface PresenterProps {
|
||||
instant: number;
|
||||
real?: boolean;
|
||||
observation: string;
|
||||
// "她此刻": what she is doing, read from the same life state as the home page (never from the playing clip).
|
||||
now?: string;
|
||||
onApproach: () => void;
|
||||
}
|
||||
// One shared room (HEL-799, approved 01a16810): far = her room and the rainy city, middle = her, near = your table.
|
||||
// Only consumes scene. No life writes, no synthesis, no microphone/camera APIs. The two stills are reference frames,
|
||||
// not her real daily video; the camera move is the approved push-in, not body motion.
|
||||
export function Presenter({ scene, space, theme, instant, real = false, observation, onApproach }: PresenterProps) {
|
||||
export function Presenter({ scene, space, theme, instant, real = false, observation, now = '', onApproach }: PresenterProps) {
|
||||
const [failed, setFailed] = useState(false);
|
||||
const cam = useRef<HTMLDivElement>(null), room = useRef<HTMLDivElement>(null), talk = useRef<HTMLDivElement>(null), moon = useRef<HTMLElement>(null), near = useRef<HTMLDivElement>(null), hit = useRef<HTMLButtonElement>(null), rainRoom = useRef<HTMLCanvasElement>(null), rainTalk = useRef<HTMLCanvasElement>(null);
|
||||
const chip = useRef<HTMLDivElement>(null);
|
||||
// While a page is open on your side of the table, "她此刻" sits just under her in the room. It follows the hit area
|
||||
// (which tracks the camera every frame) until the room has settled, and again after a resize.
|
||||
useEffect(() => {
|
||||
if (space !== 'pane' || !now) return;
|
||||
let raf = 0, until = 0;
|
||||
const place = () => { const h = hit.current?.getBoundingClientRect(), c = chip.current; if (!h || !c) return; c.style.transform = `translate3d(${Math.max(12, h.left - 6).toFixed(0)}px,${Math.min(innerHeight - 140, h.bottom + 10).toFixed(0)}px,0)`; };
|
||||
const loop = () => { place(); if (performance.now() < until) raf = requestAnimationFrame(loop); };
|
||||
const start = () => { until = performance.now() + 1400; cancelAnimationFrame(raf); loop(); };
|
||||
start(); addEventListener('resize', start);
|
||||
return () => { cancelAnimationFrame(raf); removeEventListener('resize', start); };
|
||||
}, [space, now]);
|
||||
const controller = useRef<RoomScene | null>(null), first = useRef(true), lastInstant = useRef(instant);
|
||||
useLayoutEffect(() => {
|
||||
if (!cam.current || !room.current || !talk.current || !moon.current || !near.current || !hit.current || !rainRoom.current || !rainTalk.current) return;
|
||||
@@ -70,6 +84,7 @@ export function Presenter({ scene, space, theme, instant, real = false, observat
|
||||
<div className="r-vignette"/><div className="r-veil"/>
|
||||
</div>
|
||||
<button className="her-hit" ref={hit} aria-label="走近她,开始交谈" tabIndex={space === 'home' ? 0 : -1} disabled={space !== 'home'} onClick={onApproach}><span>和她说话</span></button>
|
||||
{now && <div className="now-chip glass" ref={chip} aria-hidden={space !== 'pane'}><i/><span><b>她此刻 · {now}</b><small>{real ? '生活尚未接通 · 画面为参考静帧' : '来自演示生活状态 · 画面为参考静帧'}</small></span></div>}
|
||||
<div className="room-labels">
|
||||
{failed && <span className="chip glass">画面暂时没打开,文字仍可使用。</span>}
|
||||
{observation && <span className="chip glass observe show">{observation}</span>}
|
||||
|
||||
Reference in New Issue
Block a user