idol-commons / frontend /src /explorer /AnimationControls.tsx
fffiloni's picture
Complete bilingual responsive UI and per-asset licensing
0672639 verified
Raw History Blame Contribute Delete
1.42 kB
import {t,useLanguage} from '../i18n';
import {Play,Pause,RotateCcw} from 'lucide-react';
type Props={duration:number;progress:number;playing:boolean;onProgress:(value:number)=>void;onPlay:()=>void;onReset:()=>void};
export default function AnimationControls({duration,progress,playing,onProgress,onPlay,onReset}:Props){
useLanguage();
return <div className="motion-controls" aria-label={t("Animation controls")}>
<div className="motion-heading"><div className="motion-name"><strong>{t("Full object animation")}</strong><small>{t("Embedded animation · synchronized playback")}</small></div><span className="dock-spacer"/><button className="icon-button" aria-label={t("Reset animation")} title={t("Reset animation")} onClick={onReset}><RotateCcw size={15}/></button></div>
<div className="motion-slider-row"><button className="icon-button play-button" aria-label={playing?t("Pause animation"):t("Play animation")} onClick={onPlay}>{playing?<Pause size={18}/>:<Play size={18}/>}</button><span className="motion-limit">{(progress*duration).toFixed(1)} s</span><input className="joint-slider" aria-label={t("Animation position")} aria-valuetext={`${(progress*duration).toFixed(1)} of ${duration.toFixed(1)} seconds`} type="range" min="0" max="1" step="0.001" value={progress} onChange={event=>onProgress(+event.target.value)}/><span className="motion-limit">{duration.toFixed(1)} s</span></div>
</div>;
}