mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-01-27 06:33:18 +00:00
Implement Milestone 13 requirement: Timing fine-tuning for all transitions. Changes: - Create centralized timing configuration (src/config/timing.ts) with: - SPRING_CONFIGS: Unified spring presets (SMOOTH, SNAPPY, BOUNCY, etc.) - STAGGER_DELAYS: Consistent stagger timing for cards, lists, activities - TIMING: Scene-specific delay constants (intro, CTA, outro) - GLOW_CONFIG: Glow effect parameters (intensity, frequency, scale) - Helper functions: secondsToFrames(), getStaggeredDelay() - Fine-tune all 8 portal scenes: - Reduced perspective rotations (30° → 25° / 20° → 18°) for smoother entrances - Increased initial scales (0.8 → 0.85-0.92) for subtler animations - Reduced Y translations (30-40px → 18-25px) for less jarring motion - Standardized glow frequencies using centralized config - Consistent spring configurations across all scenes - Add comprehensive tests (src/config/timing.test.ts): - 38 tests covering all timing constants - Helper function tests - Timing consistency validation - Scene duration verification (total = 90s) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
280 lines
8.3 KiB
TypeScript
280 lines
8.3 KiB
TypeScript
import {
|
|
AbsoluteFill,
|
|
useCurrentFrame,
|
|
useVideoConfig,
|
|
interpolate,
|
|
spring,
|
|
Img,
|
|
staticFile,
|
|
Sequence,
|
|
} from "remotion";
|
|
import { Audio } from "@remotion/media";
|
|
import { ActivityItem } from "../../components/ActivityItem";
|
|
import {
|
|
SPRING_CONFIGS,
|
|
STAGGER_DELAYS,
|
|
TIMING,
|
|
GLOW_CONFIG,
|
|
secondsToFrames,
|
|
} from "../../config/timing";
|
|
|
|
// Activity feed data from the screenshot
|
|
const ACTIVITY_FEED_DATA = [
|
|
{
|
|
eventName: "EINUNDZWANZIG Kempten",
|
|
timestamp: "vor 13 Stunden",
|
|
badgeText: "Neuer Termin",
|
|
},
|
|
{
|
|
eventName: "EINUNDZWANZIG Darmstadt",
|
|
timestamp: "vor 21 Stunden",
|
|
badgeText: "Neuer Termin",
|
|
},
|
|
{
|
|
eventName: "EINUNDZWANZIG Vulkaneifel",
|
|
timestamp: "vor 2 Tagen",
|
|
badgeText: "Neuer Termin",
|
|
},
|
|
{
|
|
eventName: "BitcoinWalk Würzburg",
|
|
timestamp: "vor 2 Tagen",
|
|
badgeText: "Neuer Termin",
|
|
},
|
|
];
|
|
|
|
/**
|
|
* ActivityFeedScene - Scene 7: Activity Feed (10 seconds / 300 frames @ 30fps)
|
|
*
|
|
* Animation sequence:
|
|
* 1. 3D perspective entrance with smooth transition
|
|
* 2. Section header "Aktivitäten" animates in with fade + translateY
|
|
* 3. Activity items slide in from right with staggered timing:
|
|
* - "Neuer Termin" badge bounces in
|
|
* - Meetup name types out / fades in
|
|
* - Timestamp fades in
|
|
* 4. Stack effect: New items push existing ones down
|
|
* 5. Audio: button-click.mp3 plays per item entrance
|
|
*/
|
|
export const ActivityFeedScene: React.FC = () => {
|
|
const frame = useCurrentFrame();
|
|
const { fps } = useVideoConfig();
|
|
|
|
// 3D Perspective entrance animation using centralized config
|
|
const perspectiveSpring = spring({
|
|
frame,
|
|
fps,
|
|
config: SPRING_CONFIGS.PERSPECTIVE,
|
|
});
|
|
|
|
// Fine-tuned: Reduced initial rotation for smoother entrance
|
|
const perspectiveX = interpolate(perspectiveSpring, [0, 1], [18, 0]);
|
|
const perspectiveScale = interpolate(perspectiveSpring, [0, 1], [0.92, 1]);
|
|
const perspectiveOpacity = interpolate(perspectiveSpring, [0, 1], [0, 1]);
|
|
|
|
// Header entrance animation (delayed) - Fine-tuned timing
|
|
const headerDelay = secondsToFrames(0.35, fps);
|
|
const headerSpring = spring({
|
|
frame: frame - headerDelay,
|
|
fps,
|
|
config: SPRING_CONFIGS.SNAPPY,
|
|
});
|
|
const headerOpacity = interpolate(headerSpring, [0, 1], [0, 1]);
|
|
// Fine-tuned: Reduced Y translation
|
|
const headerY = interpolate(headerSpring, [0, 1], [-35, 0]);
|
|
|
|
// Subtitle animation (slightly more delayed) - Fine-tuned timing
|
|
const subtitleDelay = secondsToFrames(0.55, fps);
|
|
const subtitleSpring = spring({
|
|
frame: frame - subtitleDelay,
|
|
fps,
|
|
config: SPRING_CONFIGS.SNAPPY,
|
|
});
|
|
const subtitleOpacity = interpolate(subtitleSpring, [0, 1], [0, 1]);
|
|
// Fine-tuned: Reduced Y translation
|
|
const subtitleY = interpolate(subtitleSpring, [0, 1], [18, 0]);
|
|
|
|
// Base delay for activity items using centralized timing
|
|
const activityBaseDelay = secondsToFrames(TIMING.CONTENT_BASE_DELAY, fps);
|
|
|
|
// Subtle pulse for live indicator using centralized config
|
|
const pulseIntensity = interpolate(
|
|
Math.sin(frame * GLOW_CONFIG.FREQUENCY.PULSE),
|
|
[-1, 1],
|
|
[0.5, 1]
|
|
);
|
|
|
|
return (
|
|
<AbsoluteFill className="bg-zinc-900 overflow-hidden">
|
|
{/* Audio: button-click for each activity entrance */}
|
|
{ACTIVITY_FEED_DATA.map((_, index) => (
|
|
<Sequence
|
|
key={`audio-${index}`}
|
|
from={activityBaseDelay + index * STAGGER_DELAYS.ACTIVITY}
|
|
durationInFrames={Math.floor(0.5 * fps)}
|
|
>
|
|
<Audio src={staticFile("sfx/button-click.mp3")} volume={0.4} />
|
|
</Sequence>
|
|
))}
|
|
|
|
{/* Audio: slide-in for section entrance */}
|
|
<Sequence from={headerDelay} durationInFrames={Math.floor(1 * fps)}>
|
|
<Audio src={staticFile("sfx/slide-in.mp3")} volume={0.5} />
|
|
</Sequence>
|
|
|
|
{/* Wallpaper Background */}
|
|
<div className="absolute inset-0">
|
|
<Img
|
|
src={staticFile("einundzwanzig-wallpaper.png")}
|
|
className="absolute inset-0 w-full h-full object-cover"
|
|
style={{ opacity: 0.1 }}
|
|
/>
|
|
</div>
|
|
|
|
{/* Dark gradient overlay */}
|
|
<div
|
|
className="absolute inset-0"
|
|
style={{
|
|
background:
|
|
"radial-gradient(circle at 60% 50%, transparent 0%, rgba(24, 24, 27, 0.5) 40%, rgba(24, 24, 27, 0.95) 100%)",
|
|
}}
|
|
/>
|
|
|
|
{/* 3D Perspective Container */}
|
|
<div
|
|
className="absolute inset-0"
|
|
style={{
|
|
transform: `perspective(1200px) rotateX(${perspectiveX}deg) scale(${perspectiveScale})`,
|
|
transformOrigin: "center center",
|
|
opacity: perspectiveOpacity,
|
|
}}
|
|
>
|
|
{/* Main Content */}
|
|
<div className="absolute inset-0 flex flex-col items-center justify-center px-20">
|
|
{/* Section Header */}
|
|
<div
|
|
className="text-center mb-10"
|
|
style={{
|
|
opacity: headerOpacity,
|
|
transform: `translateY(${headerY}px)`,
|
|
}}
|
|
>
|
|
<div className="flex items-center justify-center gap-3 mb-3">
|
|
<h1 className="text-5xl font-bold text-white">Aktivitäten</h1>
|
|
{/* Live indicator dot */}
|
|
<div
|
|
className="flex items-center gap-2 px-3 py-1 rounded-full bg-green-500/20 border border-green-500/30"
|
|
style={{
|
|
opacity: pulseIntensity,
|
|
}}
|
|
>
|
|
<div
|
|
className="w-2 h-2 rounded-full bg-green-500"
|
|
style={{
|
|
boxShadow: `0 0 ${8 * pulseIntensity}px rgba(34, 197, 94, 0.8)`,
|
|
}}
|
|
/>
|
|
<span className="text-sm text-green-400 font-medium">LIVE</span>
|
|
</div>
|
|
</div>
|
|
<p
|
|
className="text-xl text-zinc-400"
|
|
style={{
|
|
opacity: subtitleOpacity,
|
|
transform: `translateY(${subtitleY}px)`,
|
|
}}
|
|
>
|
|
Der Puls der Bitcoin-Community
|
|
</p>
|
|
</div>
|
|
|
|
{/* Activity Feed List */}
|
|
<div className="w-full max-w-lg">
|
|
<div className="flex flex-col gap-4">
|
|
{ACTIVITY_FEED_DATA.map((activity, index) => (
|
|
<ActivityItemWrapper
|
|
key={activity.eventName}
|
|
activity={activity}
|
|
delay={activityBaseDelay + index * STAGGER_DELAYS.ACTIVITY}
|
|
index={index}
|
|
/>
|
|
))}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Vignette overlay */}
|
|
<div
|
|
className="absolute inset-0 pointer-events-none"
|
|
style={{
|
|
boxShadow: "inset 0 0 200px 50px rgba(0, 0, 0, 0.6)",
|
|
}}
|
|
/>
|
|
</AbsoluteFill>
|
|
);
|
|
};
|
|
|
|
/**
|
|
* Wrapper component for activity items with stack push-down animation
|
|
*/
|
|
type ActivityItemWrapperProps = {
|
|
activity: {
|
|
eventName: string;
|
|
timestamp: string;
|
|
badgeText: string;
|
|
};
|
|
delay: number;
|
|
index: number;
|
|
};
|
|
|
|
const ActivityItemWrapper: React.FC<ActivityItemWrapperProps> = ({
|
|
activity,
|
|
delay,
|
|
index,
|
|
}) => {
|
|
const frame = useCurrentFrame();
|
|
const { fps } = useVideoConfig();
|
|
|
|
// Calculate push-down effect from items appearing above
|
|
// Each item that appears before this one causes a slight downward push
|
|
let pushDownOffset = 0;
|
|
for (let i = 0; i < index; i++) {
|
|
const prevItemDelay = secondsToFrames(TIMING.CONTENT_BASE_DELAY, fps) + i * STAGGER_DELAYS.ACTIVITY;
|
|
const prevItemSpring = spring({
|
|
frame: frame - prevItemDelay,
|
|
fps,
|
|
config: { damping: 20, stiffness: 100 },
|
|
});
|
|
// Each previous item pushes this one down slightly when it appears
|
|
pushDownOffset += interpolate(prevItemSpring, [0, 1], [0, 0]);
|
|
}
|
|
|
|
// Container spring for the wrapper itself using centralized config
|
|
const containerSpring = spring({
|
|
frame: frame - delay,
|
|
fps,
|
|
config: SPRING_CONFIGS.SNAPPY,
|
|
});
|
|
|
|
const containerOpacity = interpolate(containerSpring, [0, 1], [0, 1]);
|
|
|
|
return (
|
|
<div
|
|
style={{
|
|
opacity: containerOpacity,
|
|
transform: `translateY(${pushDownOffset}px)`,
|
|
}}
|
|
>
|
|
<ActivityItem
|
|
eventName={activity.eventName}
|
|
timestamp={activity.timestamp}
|
|
badgeText={activity.badgeText}
|
|
showBadge={true}
|
|
delay={delay}
|
|
width={480}
|
|
accentColor="#f7931a"
|
|
/>
|
|
</div>
|
|
);
|
|
};
|