Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
"use client";
import { useDetectPlatform } from "hooks/useDetectPlatform";
import { ArrowDown, ArrowRight } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { useRef } from "react";
import { trackEvent } from "@/app/utils/analytics";
import { LoomMark } from "@/components/icons/LoomMark";
import { getDownloadUrl } from "@/utils/platform";
import { CapRecorderWindow } from "./demo/CapRecorderWindow";
import { LinkNotification } from "./demo/CapSurfaces";
import { MenuBar } from "./demo/MacDesktop";
import { AppleGlyph } from "./glyphs";
import { HeroHeadline } from "./HeroHeadline";
import { HeroSky } from "./HeroSky";
import { Fit, noop, useInView } from "./scenes/engine";
import {
BODY_TEXT,
BTN_PRIMARY,
BTN_SECONDARY,
MODE_THEME,
MONO,
meshStyle,
} from "./theme";
const PHONE_STAGE = { w: 440, h: 508 };
const PhoneStage = () => {
const boxRef = useRef<HTMLDivElement | null>(null);
const inView = useInView(boxRef, "0px");
return (
<div ref={boxRef} className="mt-10 w-full md:hidden">
<div
className="rounded-[22px] p-2.5"
style={meshStyle(MODE_THEME.instant)}
>
<Fit w={PHONE_STAGE.w} h={PHONE_STAGE.h} className="mx-auto">
<div
className="relative overflow-hidden rounded-[14px] bg-black"
style={{ width: PHONE_STAGE.w, height: PHONE_STAGE.h }}
>
{/* The stage is scaled down to phone width, so a pre-sized 960px
copy beats the 1920px variant next/image picks on dense screens. */}
<Image
src="/backgrounds/landing/sf-960.webp"
alt=""
fill
unoptimized
draggable={false}
className="object-cover"
/>
<MenuBar recording={false} onSwitchOs={noop} />
<div className="absolute z-20" style={{ left: 48, top: 30 }}>
<LinkNotification visible={inView} onOpen={noop} />
</div>
<div className="absolute z-10" style={{ left: 55, top: 104 }}>
<CapRecorderWindow
ui={{
visible: true,
mode: "instant",
displaySelected: true,
cameraOn: true,
}}
onMode={noop}
onSelectDisplay={noop}
onToggleCamera={noop}
onMiss={noop}
/>
</div>
</div>
</Fit>
</div>
</div>
);
};
const WindowsGlyph = ({ className }: { className?: string }) => (
<svg
aria-hidden="true"
className={className}
viewBox="0 0 24 24"
fill="currentColor"
>
<path d="M0,0H11.377V11.372H0ZM12.623,0H24V11.372H12.623ZM0,12.623H11.377V24H0Zm12.623,0H24V24H12.623" />
</svg>
);
const AltIcon = ({
label,
children,
}: {
label: string;
children: React.ReactNode;
}) => (
<Link
href="/download"
aria-label={`Download Cap: ${label}`}
title={label}
className="grid size-7 place-items-center rounded-[7px] text-[rgba(17,17,17,0.45)] transition-colors duration-200 hover:bg-[#E7EDF3] hover:text-[#111111] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#111111]"
>
{children}
</Link>
);
export const Hero = () => {
const { platform, isIntel } = useDetectPlatform();
const displayPlatform = platform ?? "macos";
const isWindows = displayPlatform === "windows";
const isLinux = displayPlatform === "linux";
const platformName = isWindows ? "Windows" : isLinux ? "Linux" : "macOS";
const downloadHref = isWindows
? "/download"
: getDownloadUrl(displayPlatform, isIntel);
return (
<section className="relative px-5 pb-12 pt-12 sm:pt-14 md:pb-4 md:pt-[56px]">
<HeroSky />
<span
data-header-sentinel
aria-hidden="true"
className="pointer-events-none absolute bottom-0 left-0 size-px"
/>
<div className="relative mx-auto flex max-w-[1020px] flex-col items-center text-center">
<Link
href="/blog/rebuilding-cap-in-gpui"
onClick={() =>
trackEvent("release_notice_clicked", {
source_page: "home_hero",
release: "v0.6.1",
})
}
className="ht-rise group mb-7 inline-flex [--d:0.04s] max-w-full items-center gap-2.5 rounded-full bg-[#111111] py-1.5 pl-1.5 pr-3.5 text-[13px] leading-none text-white shadow-[0_1px_2px_rgba(17,17,17,0.12),0_10px_24px_-14px_rgba(17,17,17,0.6)] transition-colors duration-200 hover:bg-[#2A2A2A] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#111111] focus-visible:ring-offset-2 focus-visible:ring-offset-[#EDF1F6] md:mb-9"
>
<span
className={`${MONO} rounded-full bg-[#8DBCF0] px-2 py-[5px] text-[10.5px] uppercase leading-none tracking-[0.06em] text-[#111111]`}
>
New
</span>
<span className="truncate">Cap's migration to GPUI</span>
<span className="hidden text-white/60 transition-colors duration-200 group-hover:text-white sm:inline">
Read the deep dive
</span>
<ArrowRight className="size-3.5 text-white/70 transition-transform duration-200 group-hover:translate-x-0.5 group-hover:text-white" />
</Link>
<HeroHeadline />
<p
className={`ht-rise [--d:0.16s] ${BODY_TEXT} mt-8 max-w-[660px] text-balance text-[16.5px] leading-[1.5] text-[rgba(17,17,17,0.78)] sm:text-[19px] md:mt-10`}
>
Record your screen, then share it as a link the moment you stop or
polish it in the built-in editor. Trusted by over 80,000 teams and
creators, and free to start.
</p>
<div className="ht-rise mt-9 flex flex-col items-stretch gap-3 [--d:0.2s] sm:flex-row sm:items-center">
<Link
href={downloadHref}
// Redirects to the installer on the CDN; prefetching it only
// produced a failed cross-origin request on every visit.
prefetch={false}
onClick={() =>
trackEvent("download_cta_clicked", {
source_page: "home_header",
cta_location: "primary",
target_url: downloadHref,
detected_platform: platform ?? "unknown",
is_intel: Boolean(isIntel),
})
}
className={BTN_PRIMARY}
>
{isWindows ? (
<WindowsGlyph className="mr-2.5 size-[18px]" />
) : isLinux ? (
<Image
src="/logos/os/linux.svg"
alt=""
width={19}
height={19}
className="mr-2.5 size-[19px]"
/>
) : (
<AppleGlyph className="mr-2.5 size-[19px]" />
)}
Download free for {platformName}
</Link>
<button
type="button"
onClick={() => {
window.dispatchEvent(new Event("ht-demo-start"));
document
.getElementById("modes")
?.scrollIntoView({ behavior: "smooth" });
}}
className={`${BTN_SECONDARY} group cursor-pointer gap-2.5`}
>
See how Cap works
<span className="grid size-6 place-items-center rounded-full bg-[#E7EDF3] text-[rgba(17,17,17,0.65)] transition-colors duration-200 group-hover:bg-[#DCE4EC] group-hover:text-[#111111]">
<ArrowDown className="size-3.5 transition-transform duration-200 group-hover:translate-y-[2px]" />
</span>
</button>
</div>
<Link
href="/migrate-from-loom"
onClick={() =>
trackEvent("loom_import_cta_clicked", {
source_page: "home_hero",
cta_location: "under_primary",
})
}
className="ht-rise group mt-5 inline-flex items-center gap-2 rounded-[6px] [--d:0.24s] text-[14px] text-[rgba(17,17,17,0.55)] transition-colors duration-200 hover:text-[#111111] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#111111] focus-visible:ring-offset-4 focus-visible:ring-offset-[#F8FAFC]"
>
<LoomMark
size={13}
className="opacity-70 transition-opacity duration-200 group-hover:opacity-100"
/>
<span>
Switching from Loom?{" "}
<span className="text-[#111111] underline decoration-[rgba(17,17,17,0.25)] underline-offset-[4px] transition-colors duration-200 group-hover:decoration-[#111111]">
Import your library
</span>
</span>
<ArrowRight className="size-3.5 transition-transform duration-200 group-hover:translate-x-0.5" />
</Link>
<div className="ht-rise mt-3 flex items-center gap-2 text-[14px] text-[rgba(17,17,17,0.5)] [--d:0.28s]">
<span>Also available on</span>
<span className="flex items-center gap-1">
{isWindows || isLinux ? (
<AltIcon label="macOS">
<AppleGlyph className="size-4" />
</AltIcon>
) : null}
{!isWindows ? (
<AltIcon label="Windows">
<WindowsGlyph className="size-[15px]" />
</AltIcon>
) : null}
{!isLinux ? (
<AltIcon label="Linux">
<Image
src="/logos/os/linux.svg"
alt=""
width={16}
height={16}
className="size-4 opacity-60"
/>
</AltIcon>
) : null}
<AltIcon label="Chrome">
<Image
src="/logos/browsers/google-chrome.svg"
alt=""
width={16}
height={16}
className="size-4 opacity-70"
/>
</AltIcon>
</span>
</div>
<PhoneStage />
</div>
</section>
);
};