How long an animation runs.
1200ms · normal preset
<div class="mot-dur-stage" data-speed="normal">
<div class="mot-dur-track">
<span class="mot-dur-dot mot-dur-dot--loop" style="background:#BFD9F2;"></span>
</div>
<p class="mot-dur-caption">1200ms · normal preset</p>
</div>
<style>
.mot-dur-stage { width: 100%; max-width: 320px; padding: 16px; background: #FAF7F2; border: 1px solid #24143022; border-radius: 12px; font: 13px system-ui, sans-serif; color: #241430aa; }
.mot-dur-track { position: relative; height: 24px; background: #24143014; border-radius: 999px; }
.mot-dur-dot { position: absolute; top: 1px; left: 1px; width: 22px; height: 22px; border-radius: 999px; }
.mot-dur-caption { margin: 10px 0 0; }
@media (prefers-reduced-motion: no-preference) {
[data-speed="snappy"] .mot-dur-dot { animation-timing-function: ease-in-out; }
[data-speed="normal"] .mot-dur-dot { animation-timing-function: ease-in-out; }
[data-speed="slow"] .mot-dur-dot { animation-timing-function: linear; }
.mot-dur-dot { animation-name: mot-dur-slide; animation-duration: 1200ms; }
.mot-dur-dot--loop { animation-iteration-count: infinite; }
@keyframes mot-dur-slide { 0%,100% { left: 1px; } 50% { left: calc(100% - 23px); } }
}
</style><div class="w-full max-w-[320px] p-4 bg-[#FAF7F2] border border-[#24143022] rounded-xl font-sans text-sm text-[#241430]/70" data-speed="normal">
<div class="relative h-6 bg-[#24143014] rounded-full">
<span class="absolute top-px left-px w-[22px] h-[22px] rounded-full tw-dur-loop" style="background:#BFD9F2;"></span>
</div>
<p class="mt-2.5">1200ms · normal preset</p>
</div>
<style>
@media (prefers-reduced-motion: no-preference) {
[data-speed="snappy"] span { animation-timing-function: ease-in-out; }
[data-speed="normal"] span { animation-timing-function: ease-in-out; }
[data-speed="slow"] span { animation-timing-function: linear; }
span { animation-name: mot-dur-tw-slide; animation-duration: 1200ms; }
.tw-dur-loop { animation-iteration-count: infinite; }
@keyframes mot-dur-tw-slide { 0%,100% { left: 1px; } 50% { left: calc(100% - 23px); } }
}
</style>export function Duration({
duration = 1200,
speed = "normal",
loop = true,
accent = "#BFD9F2",
}) {
const ease = speed === "slow" ? "linear" : "ease-in-out";
return (
<div data-speed={speed} style={{ width: "100%", maxWidth: 320, padding: 16, background: "#FAF7F2", border: "1px solid #24143022", borderRadius: 12, fontFamily: "system-ui, sans-serif", fontSize: 13, color: "#241430aa" }}>
<div style={{ position: "relative", height: 24, background: "#24143014", borderRadius: 999 }}>
<span className={loop ? "dot dot--loop" : "dot"} style={{ position: "absolute", top: 1, left: 1, width: 22, height: 22, borderRadius: 999, background: accent }} />
</div>
<p style={{ margin: "10px 0 0" }}>{duration}ms · {speed} preset</p>
<style>{`
@media (prefers-reduced-motion: no-preference) {
.dot { animation: mot-dur-slide ${duration}ms ${ease} 1; }
.dot--loop { animation-iteration-count: infinite; }
@keyframes mot-dur-slide { 0%,100% { left: 1px; } 50% { left: calc(100% - 23px); } }
}
`}</style>
</div>
);
}