本文へ移動
日本語

仕組み

The text is split into words (CJK into characters, since it has no spaces) and each piece gets its index as a CSS variable. When the element is 30% visible, every piece moves from transparent, blurred and 0.22em low to its place after delay + index × step, with an ease-out. Blur clears a little faster than the fade completes, so the words look as if they come into focus rather than simply appearing. The total spread is capped, so long text still finishes quickly. In character mode each word stays unbreakable, so lines wrap where they would anyway.

向いている場面

  • Headlines and leads of articles, landing sections and announcements.
  • A calm entrance for short text that should be noticed once.

向かない場面

  • Body text, lists or anything people need to read at once.
  • Text that changes often: every change would replay.

使い方

import { BlurInText } from './BlurInText.jsx'

export function ArticleHeader() {
  return (
    <>
      <BlurInText as="h1" text="The quiet hour before the harbour wakes" stagger={70} />
      <BlurInText text="Fishing boats idle at the breakwater." delay={500} stagger={30} blur={6} />
    </>
  )
}

プロパティ

プロパティ型既定値説明
textstring—The text to reveal.
asElementType'p'Element to render, such as h1.
by'word' | 'char''word'Pieces to animate. Chinese, Japanese and Korean always go character by character.
staggernumber60Delay between pieces in ms.
maxStaggernumber1400Cap on the total spread, so long text does not take forever.
durationnumber700Duration of each piece in ms.
blurnumber10Starting blur in px.
delaynumber0Delay before the first piece in ms.
trigger'view' | 'mount''view'Start when visible, or at once.
onDone() => void—Called when the last piece has settled.

アクセシビリティ

  • The full text sits in a visually hidden span, so screen readers read it once as a sentence; the animated pieces are aria-hidden.
  • The rendered element (as) keeps its semantics, such as a heading level.
  • Nothing is interactive and no content is withheld: the reveal finishes within about two seconds.
  • Reduced motion replaces the blur, movement and stagger with one short fade of the whole text.

モーション

Each piece takes 700ms with an ease-out (blur clears in 80% of that), starting index × 60ms after the delay, with the whole spread capped at 1.4s.

プロジェクトに追加

プロンプトを Codex または Claude Code に貼り付けます。エージェントが公開ソースを読み、書き込む内容を示したうえで、既存のコンポーネントの隣に追加します。

BlurInText.jsxblur-in-text.csstokens.cssREADME.md

2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。

文字の動き
「モーフィング文字」は Pro に含まれます。解除するとプレビューが表示されます。
「スクランブル文字」は Pro に含まれます。解除するとプレビューが表示されます。