import React from 'react';
import {spring, useCurrentFrame, useVideoConfig} from 'remotion';
import {kurve} from '../bewegung';
import {Figur, Kamera} from './figur';
import {Blende, Vignette, kamFahrt} from './helfer';
import {Blatt} from './natur';
import {W} from './sprache';
import {SCHRIFT, Untertitel} from './untertitel';
import {plane, type Plan, type Zeile} from './zeit';
// Das Bilderbuch: öffnet sich am Anfang (Intro) und klappt am Ende zu.
// Buchrücken bei x = 960; geschlossen liegt der Deckel rechts davon.
const OBEN = 190;
const HOEHE = 700;
const BREITE = 700;
const Seite: React.FC<{links: number; children?: React.ReactNode}> = ({links, children}) => (
{children}
);
const Titel: React.FC<{text: string; groesse: number; farbe?: string; y: number}> = ({text, groesse, farbe = '#c8642c', y}) => (
{text}
);
// Deckel: dreht sich um den Buchrücken (0° = zu, -180° = offen)
const Deckel: React.FC<{winkel: number}> = ({winkel}) => (
1 ? 72 : 84} farbe="#f6dc95" y={W.kanalZeilen.length > 1 ? 92 : 120} />
{[0, 1, 2, 3, 4, 5].map((i) => (
))}
1 ? 180 : 230} />
1 ? 365 : 340} />
);
const Innenseiten: React.FC<{frame: number; auf: number; titel: string; posen: [string, string, string]}> = ({frame, auf, titel, posen}) => {
const {fps} = useVideoConfig();
const pop = (i: number) => spring({frame: frame - auf - 8 - i * 6, fps, config: {damping: 11, stiffness: 120}});
return (
<>
{posen.map((p, i) => {
const s = pop(i);
const x = [180, 340, 520][i];
const h = [96, 230, 440][i];
return ;
})}
>
);
};
const Tisch: React.FC = () => (
);
// Intro: Buch geht auf, Figuren springen auf die Seite, Kamera fährt in die Seite.
// Die Folge plant die Zeilen selbst (mit `introZeilen`), damit Aufnahmen greifen.
export const introZeilen = (folgenTitel: string): Zeile[] => [
{id: 'buch', dauer: 2.2},
{id: 't1', wer: 'ERZ', text: `${W.kanal}.`},
{id: 't2', wer: 'ERZ', text: W.heute(folgenTitel)},
];
export const INTRO_OPTIONEN = {vorlauf: 0.3, nachlauf: 1.6};
type IntroProps = {plan: Plan; titel: string; posen?: [string, string, string]};
export const Intro: React.FC = ({plan, titel, posen = ['pino_A3_lachen', 'noa_A3_lachen', 'lulu_A3_lachen']}) => {
const frame = useCurrentFrame();
const {z, dauer} = plan;
const auf = 30;
const winkel = kurve(frame, [
[auf, 0],
[auf + 40, -180],
]);
const kam = kamFahrt(frame, [
[0, 1310, 540, 1.25],
[auf, 1310, 540, 1.25],
[auf + 45, 960, 540, 1.05],
[z.t2.ende, 960, 540, 1.08],
[dauer, 1310, 520, 2.6],
]);
return (
<>
{winkel < -90 && }
{winkel >= -90 && }
>
);
};
// Outro: Seite mit winkenden Figuren, Buch klappt zu.
export const OUTRO = plane([{id: 'buch', dauer: 4.5}], {vorlauf: 0.2, nachlauf: 0.6});
export const Outro: React.FC<{posen?: [string, string, string]}> = ({posen = ['pino_B3_schlafen', 'noa_A_arm-hoch-winken', 'lulu_A3_lachen']}) => {
const frame = useCurrentFrame();
const {dauer} = OUTRO;
const zu = 60;
const winkel = kurve(frame, [
[zu, -180],
[zu + 40, 0],
]);
const kam = kamFahrt(frame, [
[0, 1310, 520, 2.4],
[25, 960, 540, 1.05],
[zu + 20, 1150, 540, 1.1],
[dauer, 1310, 540, 1.2],
]);
return (
<>
{winkel < -90 && }
{winkel >= -90 && }
>
);
};