Ease-In / Ease-Out

Easing that accelerates in / decelerates out.

ease-in: slow at the start or end of the move

html

<div class="mot-eio-stage" data-phase="ease-in">
  <svg viewBox="0 0 60 60" width="60" height="60" aria-hidden="true">
    <path d="M4,4 L4,56 L56,56" fill="none" stroke="#24143033" stroke-width="1.5"/>
    <path class="mot-eio-curve mot-eio-curve--in" d="M4,56 C30,56 40,20 56,4" fill="none" stroke="#A8E6C1" stroke-width="3"/>
    <path class="mot-eio-curve mot-eio-curve--out" d="M4,56 C4,20 30,4 56,4" fill="none" stroke="#A8E6C1" stroke-width="3"/>
  </svg>
  <div class="mot-eio-track">
    <span class="mot-eio-dot mot-eio-dot--loop" style="background:#A8E6C1;"></span>
  </div>
  <p class="mot-eio-caption">ease-in: slow at the start or end of the move</p>
</div>
<style>
.mot-eio-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-eio-curve { display: none; }
[data-phase="ease-in"] .mot-eio-curve--in, [data-phase="ease-out"] .mot-eio-curve--out { display: block; }
.mot-eio-track { position: relative; height: 24px; background: #24143014; border-radius: 999px; margin-top: 10px; }
.mot-eio-dot { position: absolute; top: 1px; left: 1px; width: 22px; height: 22px; border-radius: 999px; }
.mot-eio-caption { margin: 8px 0 0; }
@media (prefers-reduced-motion: no-preference) {
  .mot-eio-dot { animation-duration: 1200ms; animation-name: mot-eio-slide; }
  [data-phase="ease-in"] .mot-eio-dot { animation-timing-function: ease-in; }
  [data-phase="ease-out"] .mot-eio-dot { animation-timing-function: ease-out; }
  .mot-eio-dot--loop { animation-iteration-count: infinite; }
  @keyframes mot-eio-slide { 0%,100% { left: 1px; } 50% { left: calc(100% - 23px); } }
}
</style>

tailwind

<div class="w-full max-w-[320px] p-4 bg-[#FAF7F2] border border-[#24143022] rounded-xl font-sans text-sm text-[#241430]/70" data-phase="ease-in">
  <svg viewBox="0 0 60 60" width="60" height="60" aria-hidden="true">
    <path d="M4,4 L4,56 L56,56" fill="none" stroke="#24143033" stroke-width="1.5"/>
    <path class="tw-eio-curve tw-eio-curve--in" d="M4,56 C30,56 40,20 56,4" fill="none" stroke="#A8E6C1" stroke-width="3"/>
    <path class="tw-eio-curve tw-eio-curve--out" d="M4,56 C4,20 30,4 56,4" fill="none" stroke="#A8E6C1" stroke-width="3"/>
  </svg>
  <div class="relative h-6 bg-[#24143014] rounded-full mt-2.5">
    <span class="absolute top-px left-px w-[22px] h-[22px] rounded-full tw-eio-loop" style="background:#A8E6C1;"></span>
  </div>
  <p class="mt-2">ease-in: slow at the start or end of the move</p>
</div>
<style>
.tw-eio-curve { display: none; }
[data-phase="ease-in"] .tw-eio-curve--in, [data-phase="ease-out"] .tw-eio-curve--out { display: block; }
@media (prefers-reduced-motion: no-preference) {
  [data-phase="ease-in"] span { animation-timing-function: ease-in; }
  [data-phase="ease-out"] span { animation-timing-function: ease-out; }
  span { animation-name: mot-eio-tw-slide; animation-duration: 1200ms; }
  .tw-eio-loop { animation-iteration-count: infinite; }
  @keyframes mot-eio-tw-slide { 0%,100% { left: 1px; } 50% { left: calc(100% - 23px); } }
}
</style>

react

export function EaseInEaseOut({
  phase = "ease-in",
  duration = 1200,
  loop = true,
  accent = "#A8E6C1",
}) {
  const path = phase === "ease-in" ? "M4,56 C30,56 40,20 56,4" : "M4,56 C4,20 30,4 56,4";
  return (
    <div data-phase={phase} style={{ width: "100%", maxWidth: 320, padding: 16, background: "#FAF7F2", border: "1px solid #24143022", borderRadius: 12, fontFamily: "system-ui, sans-serif", fontSize: 13, color: "#241430aa" }}>
      <svg viewBox="0 0 60 60" width="60" height="60" aria-hidden="true">
        <path d="M4,4 L4,56 L56,56" fill="none" stroke="#24143033" strokeWidth="1.5" />
        <path d={path} fill="none" stroke={accent} strokeWidth="3" />
      </svg>
      <div style={{ position: "relative", height: 24, background: "#24143014", borderRadius: 999, marginTop: 10 }}>
        <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: "8px 0 0" }}>{phase}: {loop ? "slow at the " : ""}start or end of the move</p>
      <style>{`
        @media (prefers-reduced-motion: no-preference) {
          .dot { animation: mot-eio-slide ${duration}ms ${phase} 1; }
          .dot--loop { animation-iteration-count: infinite; }
          @keyframes mot-eio-slide { 0%,100% { left: 1px; } 50% { left: calc(100% - 23px); } }
        }
      `}</style>
    </div>
  );
}