'use client';
import { useScroll, useTransform, motion } from 'framer-motion';
import { ReactNode } from 'react';
import Link from 'next/link';
interface SectionProps {
children: ReactNode;
progress: any;
startAt: number;
peakAt: number;
endAt: number;
align: 'center' | 'left' | 'right';
verticalAlign?: 'top' | 'center' | 'bottom';
offsetY?: number;
className?: string;
}
function OverlaySection({
children,
progress,
startAt,
peakAt,
endAt,
align,
verticalAlign = 'center',
offsetY = 50,
className = '',
}: SectionProps) {
// Define a wide "plateau" zone where the text is fully readable and static.
// We use 30% of the travel distance for fading in, 30% for fading out.
const diffIn = peakAt - startAt;
const diffOut = endAt - peakAt;
const inStart = startAt;
const inEnd = startAt + diffIn * 0.4; // Fades in quickly
const outStart = endAt - diffOut * 0.6; // Holds for a long time
const outEnd = endAt;
// Smooth fade in and out mapping over a lengthy plateau
const opacity = useTransform(
progress,
[inStart, inEnd, outStart, outEnd],
[0, 1, 1, 0]
);
// Translate Y to slide in, pause entirely while reading, slide out
const y = useTransform(
progress,
[inStart, inEnd, outStart, outEnd],
[offsetY, 0, 0, -offsetY]
);
// Scale stays at 1.0 during reading mode
const scale = useTransform(
progress,
[inStart, inEnd, outStart, outEnd],
[0.95, 1, 1, 1.05]
);
const alignStyle: React.CSSProperties =
align === 'left'
? { alignItems: 'flex-start' }
: align === 'right'
? { alignItems: 'flex-end' }
: { left: '50%', transform: 'translateX(-50%)', alignItems: 'center' };
const alignClass =
align === 'left'
? 'overlay-section-left'
: align === 'right'
? 'overlay-section-right'
: 'overlay-section-center';
const verticalStyle: React.CSSProperties =
verticalAlign === 'top'
? { top: '15vh' }
: verticalAlign === 'bottom'
? { bottom: '15vh', top: 'auto' }
: { top: '50%' };
// Glass panel appearance for side text to not clash with the robot
const isCenter = align === 'center';
const panelStyle: React.CSSProperties = isCenter
? { textAlign: 'center' }
: {
background: 'rgba(255, 255, 255, 0.92)',
backdropFilter: 'blur(20px)',
WebkitBackdropFilter: 'blur(20px)',
boxShadow: '0 8px 32px rgba(0, 0, 0, 0.08)',
border: '1px solid rgba(255, 255, 255, 0.6)',
textAlign: align === 'left' ? 'left' : 'right',
};
return (
Pioneering Humanoid Robotics in the UAE
Meet the G1 Humanoid Robot. Fully customizable, enterprise-ready, designed for the world of tomorrow.
Advanced computer vision and neural processing. The G1 sees, interprets, and responds to the world in real-time.
From traditional Emarati Kandura to industrial safety gear and professional business attire. Configure every detail to match your brand.
State-of-the-art locomotion enabling natural human-like movement, balance, and agility across any terrain.