Fichiers
remotion-test/src/InvitationMind.tsx
T

145 lignes
7.6 KiB
TypeScript

import React from 'react';
import {AbsoluteFill, Sequence, useCurrentFrame} from 'remotion';
import {loadFont} from '@remotion/google-fonts/Inter';
import {C, Icon, IconBlock, Words, Rule, Shot, FullShot, MindUI, useSpr, MindTimes} from './NouveauteMind';
const {fontFamily} = loadFont('normal', {weights: ['400', '500', '600', '700', '800'], subsets: ['latin']});
export const FPS_IM = 30;
const s = (sec: number) => Math.round(sec * FPS_IM);
// Échanges RÉELS posés à Mind en production le 17/10/2026 (API publique, sans connexion).
// Voir SCRIPT-invitation-1017.md pour les réponses brutes, les vérifications et les sources.
const Q_A = 'Quel est le point culminant du Vercors et quelle est son altitude ?';
const R_A = "Le point culminant du Vercors est le Grand Veymont, qui culmine à 2 341 mètres d'altitude.";
const S_A = ['laviesauvage-rando.com', 'decathlon-outdoor.com', 'paysages-hautesalpes.fr'];
const T_A: MindTimes = {type0: 14, type1: 66, send: 74, status0: 88, ans0: 132, src: 186, ansDur: 44};
const Q_B = 'Quand et comment le Mont Aiguille a-t-il été gravi pour la première fois ?';
// Extrait : première phrase de la réponse brute (la seconde, sur la « face de 300 mètres », n'est pas reprise).
const R_B = 'La première ascension du mont Aiguille a eu lieu le 26 juin 1492 par Antoine De Ville et ses hommes.';
const S_B = ['alpinemag.fr'];
const T_B: MindTimes = {type0: 10, type1: 56, send: 64, status0: 78, ans0: 112, src: 156, ansDur: 40};
type Cap = {from: number; n: string; text: string; hl: number[]};
const Demo: React.FC<{q: string; r: string; src: string[]; t: MindTimes; label: string; sub: string; caps: Cap[]; stamp: string; stampAt: number; accent: string}> = ({
q, r, src, t, label, sub, caps, stamp, stampAt, accent,
}) => {
const f = useCurrentFrame();
const cap = [...caps].reverse().find((c) => f >= c.from) ?? caps[0];
const k = 1.5;
const st = useSpr(stampAt, 20);
return (
<AbsoluteFill style={{padding: '0 60px'}}>
<div style={{position: 'absolute', top: 150, left: 60, display: 'flex', alignItems: 'center', gap: 16}}>
<div style={{background: C.jaune, color: C.ink, fontWeight: 800, fontSize: 30, letterSpacing: 5, padding: '8px 18px', border: `3px solid ${C.ink}`}}>{label}</div>
<span style={{fontSize: 28, fontWeight: 600, color: C.soft}}>{sub}</span>
</div>
<div style={{position: 'absolute', top: 240, left: 60, width: 960, height: 640 * k}}>
<div style={{position: 'absolute', inset: 0, transform: 'translate(16px,16px)', background: accent}} />
<div style={{position: 'absolute', left: 0, top: 0, width: 640, height: 640, transform: `scale(${k})`, transformOrigin: '0 0', border: `3px solid ${C.ink}`, boxSizing: 'content-box', margin: -3}}>
<MindUI question={q} reponse={r} sources={src} t={t} />
</div>
</div>
<div key={cap.n} style={{position: 'absolute', top: 1290, left: 60, right: 60, display: 'flex', gap: 30, alignItems: 'flex-start'}}>
<div style={{fontSize: 150, fontWeight: 800, color: C.line, lineHeight: 0.8}}>{cap.n}</div>
<div style={{flex: 1}}>
<Words text={cap.text} size={74} delay={0} hl={cap.hl} accent={accent} weight={700} />
</div>
</div>
{f >= stampAt && (
<div style={{position: 'absolute', left: 60, right: 60, top: 1600, display: 'flex', alignItems: 'center', gap: 24, transformOrigin: 'left', transform: `scale(${0.8 + 0.2 * st})`, opacity: Math.min(1, st * 2)}}>
<div style={{width: 96, height: 96, background: C.vert, border: `3px solid ${C.ink}`, display: 'flex', alignItems: 'center', justifyContent: 'center'}}>
<Icon name="check" size={60} color="#fff" stroke={2.4} />
</div>
<div style={{fontSize: 46, fontWeight: 800, letterSpacing: -1, lineHeight: 1.1}}>{stamp}</div>
</div>
)}
</AbsoluteFill>
);
};
const CAPS_A: Cap[] = [
{from: 0, n: '1', text: 'Une vraie question.', hl: [1, 2]},
{from: T_A.send, n: '2', text: 'Mind cherche sur le web.', hl: [2, 3, 4]},
{from: T_A.ans0, n: '3', text: 'Sa vraie réponse.', hl: [1, 2]},
];
const CAPS_B: Cap[] = [
{from: 0, n: '1', text: 'Une autre ?', hl: [0, 1]},
{from: T_B.send, n: '2', text: 'Même méthode.', hl: [1]},
{from: T_B.ans0, n: '3', text: 'Réponse en direct.', hl: [0, 1]},
];
const Hook: React.FC = () => {
const p = useSpr(26);
return (
<div style={{display: 'flex', flexDirection: 'column', gap: 50}}>
<IconBlock name="montagne" accent={C.orange} size={230} delay={4} />
<Words text="Une vraie question." size={150} delay={8} hl={[1, 2]} accent={C.orange} />
<Words text="Une vraie réponse." size={150} delay={s(1.2)} hl={[1, 2]} accent={C.bleu} />
<div style={{height: 34, width: `${p * 100}%`, background: C.jaune, maxWidth: 600}} />
</div>
);
};
const Ask: React.FC = () => (
<div style={{display: 'flex', flexDirection: 'column', gap: 50}}>
<IconBlock name="chat" accent={C.vert} size={240} delay={4} fill={false} />
<Words text="Et toi," size={120} delay={6} weight={600} color={C.soft} />
<Words text="qu’est-ce que tu lui demanderais ?" size={118} delay={14} hl={[4, 5, 6]} accent={C.vert} />
<Rule delay={30} />
</div>
);
const Cta: React.FC = () => {
const p = useSpr(20);
return (
<div style={{display: 'flex', flexDirection: 'column', gap: 50}}>
<Words text="Pose-lui sur" size={130} delay={0} weight={700} />
<div style={{background: C.ink, color: '#fff', padding: '26px 34px', fontSize: 92, fontWeight: 800, letterSpacing: -2, transformOrigin: 'left', transform: `scaleX(${p})`, whiteSpace: 'nowrap', width: 'fit-content'}}>
mind.gastinel.me
</div>
<div style={{display: 'flex', alignItems: 'center', gap: 24}}>
<Icon name="fleche" size={80} color={C.bleu} stroke={2.4} />
<Words text="Gastinel Mind" size={70} delay={20} weight={600} color={C.soft} />
</div>
</div>
);
};
type Plan = {dur: number; accent: string; chap: string; node: React.ReactNode; full?: boolean};
const plans: Plan[] = [
{dur: s(3.2), accent: C.jaune, chap: 'INVITATION · MIND', node: <Hook />},
{dur: s(10), accent: C.bleu, chap: 'EN DIRECT', node: <Demo q={Q_A} r={R_A} src={S_A} t={T_A} label="RÉPONSE RÉELLE" sub="posée à Mind · interface reconstituée" caps={CAPS_A} stamp="Vérifié : 2 341 m (Wikipédia)" stampAt={216} accent={C.bleu} />, full: true},
{dur: s(7.5), accent: C.orange, chap: 'EN DIRECT', node: <Demo q={Q_B} r={R_B} src={S_B} t={T_B} label="RÉPONSE RÉELLE" sub="extrait · interface reconstituée" caps={CAPS_B} stamp="Vérifié : 26 juin 1492 (Wikipédia)" stampAt={180} accent={C.orange} />, full: true},
{dur: s(3.4), accent: C.vert, chap: 'À TOI', node: <Ask />},
{dur: s(3.6), accent: C.bleu, chap: 'À TOI', node: <Cta />},
];
export const TOTAL_IM = plans.reduce((a, x) => a + x.dur, 0);
export const InvitationMind: React.FC = () => {
const frame = useCurrentFrame();
let from = 0;
return (
<AbsoluteFill style={{background: C.bg, fontFamily, color: C.ink}}>
{plans.map((pl, i) => {
const el = (
<Sequence key={i} from={from} durationInFrames={pl.dur}>
{pl.full ? (
<FullShot dur={pl.dur} accent={pl.accent} chap={pl.chap}>{pl.node}</FullShot>
) : (
<Shot dur={pl.dur} accent={pl.accent} chap={pl.chap}>{pl.node}</Shot>
)}
</Sequence>
);
from += pl.dur;
return el;
})}
<div style={{position: 'absolute', left: 0, bottom: 0, height: 6, width: `${(frame / TOTAL_IM) * 100}%`, background: C.ink}} />
</AbsoluteFill>
);
};