File size: 2,009 Bytes
61db3dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { useRef } from "react"
import { useLoop } from "@/hooks/motion"
import { MarkLockup } from "@/components/lockup"

/** Footage from minimax.io, one subject per modality: the M3.1 flower, the H3 jellyfish, the
 *  H3-Image coral, the Speech manta for music. Each fades to white at its foot. */
const media = (kind: "hero" | "tile", cat: string) => {
  const c = ["language", "video", "image", "music"].includes(cat) ? cat : "language"
  return { src: `media/${kind}-${c}.mp4`, poster: `media/${kind}-${c}.jpg` }
}

/** The moving background at the top of a page, as on minimax.io: full width, taller than the
 *  first screen, fading into the white page. Purely decorative. */
export function HeroVideo({ cat }: { cat: string }) {
  const ref = useRef<HTMLVideoElement>(null)
  useLoop(ref)
  const m = media("hero", cat)
  return (
    <div aria-hidden className="pointer-events-none absolute inset-x-0 top-0 -z-10 h-[clamp(820px,104vw,1500px)] overflow-hidden">
      <video ref={ref} key={cat} src={m.src} poster={m.poster} muted loop playsInline preload="auto"
             className="size-full object-cover object-top" />
      {/* the footage ends a shade off white; this closes the seam */}
      <div className="absolute inset-x-0 bottom-0 h-[22%] bg-gradient-to-b from-white/0 to-white" />
    </div>
  )
}

/** A model card's picture, as on minimax.io: its modality's footage with the model mark on it. */
export function Tile({ name, cat }: { name: string; cat: string }) {
  const ref = useRef<HTMLVideoElement>(null)
  useLoop(ref)
  const m = media("tile", cat)
  return (
    <div className="relative isolate aspect-[5/4] overflow-hidden rounded-[14px]">
      <video ref={ref} src={m.src} poster={m.poster} muted loop playsInline preload="metadata" aria-hidden
             className="absolute inset-0 -z-10 size-full scale-[1.02] object-cover" />
      <div className="grid size-full place-items-center px-3 text-white">
        <MarkLockup name={name} />
      </div>
    </div>
  )
}