Skip to content

fix(text): glitch, roll text improvements#498

Merged
sudhashrestha merged 8 commits into
mainfrom
feat/glitch-roll-text-improvements
Jun 11, 2026
Merged

fix(text): glitch, roll text improvements#498
sudhashrestha merged 8 commits into
mainfrom
feat/glitch-roll-text-improvements

Conversation

@sudhashrestha

@sudhashrestha sudhashrestha commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added a reusable GlitchText component with customizable intensity, duration, colors, and blend modes plus accompanying styles and Storybook story.
  • Improvements

    • Simplified and reworked roll-text animation for a more consistent, performant rolling effect.
  • Documentation

    • Added a detailed Category Glyphs spec and updated contributor guides and glitch-text docs with usage and accessibility notes.
  • Changes

    • Removed several landing page sections to reorganize frontpage content.

sudhashrestha and others added 5 commits June 11, 2026 15:27
Replace dual-panel keyframes with a single flex stack and -50% translate
for cleaner baseline alignment and per-unit stagger timing.

Co-authored-by: Cursor <cursoragent@cursor.com>
Move keyframes and tuning to glitch-text.css with em-scaled offsets, optional
props for React ergonomics, and updated docs plus landing usage.

Co-authored-by: Cursor <cursoragent@cursor.com>
SectionThree is not mounted on the current landing page.

Co-authored-by: Cursor <cursoragent@cursor.com>
These blocks are not imported by the current landing page.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document the /components pictogram spec and link it from the contributing
index and component authoring flow.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sudhashrestha sudhashrestha requested a review from hari June 11, 2026 10:15
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploying animata with  Cloudflare Pages  Cloudflare Pages

Latest commit: a13f5b0
Status: ✅  Deploy successful!
Preview URL: https://79303c43.animata.pages.dev
Branch Preview URL: https://feat-glitch-roll-text-improv.animata.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4e1900f4-fdb4-4075-ac7c-c07fe7c55e99

📥 Commits

Reviewing files that changed from the base of the PR and between ecd1c80 and a13f5b0.

📒 Files selected for processing (4)
  • content/docs/contributing/category-glyphs-spec.md
  • content/docs/contributing/category-glyphs.mdx
  • content/docs/contributing/components.mdx
  • content/docs/contributing/index.mdx
✅ Files skipped from review due to trivial changes (3)
  • content/docs/contributing/index.mdx
  • content/docs/contributing/category-glyphs.mdx
  • content/docs/contributing/category-glyphs-spec.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • content/docs/contributing/components.mdx

📝 Walkthrough

Walkthrough

This PR refactors GlitchText into a reusable CSS-driven component, rewrites RollText's stack-based animation system and timing, and adds canonical category-glyph contributing docs and a practical glyph spec.

Changes

GlitchText Component Refactor

Layer / File(s) Summary
CSS glitch effect
animata/text/glitch-text.css
Three grid-layer text parts (ghost-a, ghost-b, base) with blend modes, CSS custom properties for intensity/step/duration/colors, derived em-relative x/y offsets, and two keyframes (glitch-a, glitch-b) plus reduced-motion handling.
Component, helper, and story
animata/text/glitch-text.tsx, animata/text/glitch-text.stories.tsx, content/docs/text/glitch-text.mdx
GlitchTextProps interface, glitchDuration helper, and GlitchText component renders three layered spans mapping props to CSS variables; Storybook meta simplified and Primary story updated to use children/className with custom render wrapper; docs/usage/frontmatter updated to the children-based API.
GlitchText docs and example usage
content/docs/text/index.mdx
Example usage updated to pass text as children and adjust className for the new component API.

RollText Animation Update

Layer / File(s) Summary
CSS stack-based layout and keyframe
animata/text/roll-text.css
--roll-line-height set to 1; two-panel front/back layout replaced with inline-grid + sizer + clipped stack; panel keyframes removed and single roll-stack-open keyframe added; state selectors and reduced-motion rules updated to target the stack.
Timing, wiring, and markup
animata/text/roll-text.tsx
segmentTiming() simplified to fixed duration; RollUnit accepts onStackAnimationEnd and attaches onAnimationEnd to .roll-unit__stack; markup renders two duplicated lines inside the stack; isMotionActive removed; new handleStackAnimationEnd manages remaining counts and phase transitions.

Category Glyph and Contributing Docs

Layer / File(s) Summary
Canonical glyph specification
content/docs/contributing/category-glyphs-spec.md
SVG canvas/viewBox rules, three-token shade system (--cg-ink, --cg-soft, --cg-faint), stroke tiers, corner-radius conventions, helper component expectations, hover micro-interaction implementation, creation checklist, and reference category-to-motion mappings.
Contributing workflow and references
content/docs/contributing/category-glyphs.mdx, content/docs/contributing/components.mdx, content/docs/contributing/index.mdx
New category-glyphs.mdx page documents the process to introduce new component categories with corresponding SVG pictograms; components.mdx and contributing index updated to require and reference the glyph specification for top-level categories.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • codse/animata#424: Overlaps landing page components and prior GlitchText usage changes.
  • codse/animata#494: Related to RollText implementation and prior roll animation structure.

Suggested reviewers

  • hari

Poem

🐰 In three soft layers the letters twitch,
Ghosts of color jump and switch.
Roll lines stack and gently slide,
Glyphs arrive to paint the guide.
Hooray—new motion, styled with pride!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: improvements to glitch text and roll text components across styling and implementation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/glitch-roll-text-improvements

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
content/docs/contributing/index.mdx (1)

27-27: 💤 Low value

Consider aligning terminology with components.mdx for consistency.

This line says "new component category" while content/docs/contributing/components.mdx:49 says "top-level category (new sidebar section)". Using consistent terminology across both files would improve clarity, since "top-level category" more precisely describes the categories that require glyphs (those appearing on /components, not meta sections like "Getting Started" or "Contributing").

♻️ Suggested alignment
-When you add a **new component category**, also read [category glyph tiles](/docs/contributing/category-glyphs) — the SVG pictograms on `/components` follow a strict three-shade, stroke-tier spec documented in `animata/skeleton/CATEGORY-GLYPHS.md`.
+When you add a **new top-level component category** (new sidebar section), also read [category glyph tiles](/docs/contributing/category-glyphs) — the SVG pictograms on `/components` follow a strict three-shade, stroke-tier spec documented in `animata/skeleton/CATEGORY-GLYPHS.md`.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@content/docs/contributing/index.mdx` at line 27, Replace the phrase "new
component category" in the sentence starting with "When you add a **new
component category**" so it matches the terminology used in
content/docs/contributing/components.mdx — e.g., change it to "top-level
category (new sidebar section)"; update the surrounding sentence to read "When
you add a top-level category (new sidebar section), also read [category glyph
tiles]…" to ensure consistency with components.mdx and clarify that this applies
to categories shown on /components.
animata/text/roll-text.tsx (1)

247-253: ⚡ Quick win

onAnimationEnd fires once per segment, not once per animation cycle.

The prop onAnimationEnd (inherited from the span props) is forwarded from each segment's stack animation. With character-level stagger, this fires N times (one per character). Consumers expecting a single "animation complete" callback may be surprised.

Consider either:

  1. Documenting this behavior clearly in JSDoc.
  2. Providing a separate onRollComplete prop that fires only when all segments finish (at line 252).
Option 2: Add dedicated completion callback
 export interface RollTextProps extends Omit<React.ComponentPropsWithoutRef<"span">, "children"> {
   ...
+  /** Called once when the entire roll animation completes. */
+  onRollComplete?: () => void;
 }
   const handleStackAnimationEnd = (event: React.AnimationEvent<HTMLSpanElement>) => {
     onAnimationEnd?.(event);
     if (phaseRef.current !== "animating") return;
 
     remainingRef.current -= 1;
-    if (remainingRef.current <= 0) setPhase("open");
+    if (remainingRef.current <= 0) {
+      setPhase("open");
+      onRollComplete?.();
+    }
   };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@animata/text/roll-text.tsx` around lines 247 - 253, The
handleStackAnimationEnd handler currently forwards the inherited onAnimationEnd
for every character segment, causing N callbacks; change the component API to
accept a new onRollComplete?: () => void prop and keep onAnimationEnd behavior
for per-segment events but invoke onRollComplete only when remainingRef.current
<= 0 (just before calling setPhase("open")). Update the component props/type
declarations to include onRollComplete, and ensure handleStackAnimationEnd (and
any callers) call onRollComplete once when the final segment finishes while
preserving existing phaseRef/remainingRef logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@animata/text/glitch-text.stories.tsx`:
- Line 18: The className for the headline story is using the mono font variable;
update the value where className is defined (the line with className:
"font-(family-name:--font-mono) ...") to reference the display font variable
instead (use --font-display) so the headline uses the correct display font;
ensure the rest of the class string (text-8xl font-bold tracking-tight
text-white) remains unchanged.

In `@content/docs/contributing/category-glyphs.mdx`:
- Around line 57-60: Update the documentation to match the real implementation:
state that the base class is "cg-motion" (used via className={cn("cg-motion",
...)}) rather than "cg cg-<name>", and clarify that the hover transforms are not
in category-glyphs.css but applied inline as Tailwind utility classes composed
with cn() (e.g., motion-safe:group-hover/cg:scale-x-125), while
category-glyphs.css only defines base transform-box, transform-origin, and
transition properties for .cg-motion.

---

Nitpick comments:
In `@animata/text/roll-text.tsx`:
- Around line 247-253: The handleStackAnimationEnd handler currently forwards
the inherited onAnimationEnd for every character segment, causing N callbacks;
change the component API to accept a new onRollComplete?: () => void prop and
keep onAnimationEnd behavior for per-segment events but invoke onRollComplete
only when remainingRef.current <= 0 (just before calling setPhase("open")).
Update the component props/type declarations to include onRollComplete, and
ensure handleStackAnimationEnd (and any callers) call onRollComplete once when
the final segment finishes while preserving existing phaseRef/remainingRef
logic.

In `@content/docs/contributing/index.mdx`:
- Line 27: Replace the phrase "new component category" in the sentence starting
with "When you add a **new component category**" so it matches the terminology
used in content/docs/contributing/components.mdx — e.g., change it to "top-level
category (new sidebar section)"; update the surrounding sentence to read "When
you add a top-level category (new sidebar section), also read [category glyph
tiles]…" to ensure consistency with components.mdx and clarify that this applies
to categories shown on /components.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4d737c97-0e49-48e0-877e-5c441978a1fc

📥 Commits

Reviewing files that changed from the base of the PR and between d0f986f and d8bdc5a.

📒 Files selected for processing (13)
  • animata/text/glitch-text.css
  • animata/text/glitch-text.stories.tsx
  • animata/text/glitch-text.tsx
  • animata/text/roll-text.css
  • animata/text/roll-text.tsx
  • app/(main)/_landing/section-one.tsx
  • app/(main)/_landing/section-three.tsx
  • app/(main)/_landing/section-two.tsx
  • content/docs/contributing/category-glyphs.mdx
  • content/docs/contributing/components.mdx
  • content/docs/contributing/index.mdx
  • content/docs/text/glitch-text.mdx
  • content/docs/text/index.mdx
💤 Files with no reviewable changes (3)
  • app/(main)/_landing/section-three.tsx
  • app/(main)/_landing/section-one.tsx
  • app/(main)/_landing/section-two.tsx

Comment thread animata/text/glitch-text.stories.tsx
Comment thread content/docs/contributing/category-glyphs.mdx
Document cg-motion + Tailwind hover utilities, shade tokens on
category-skeleton.tsx, and add the canonical CATEGORY-GLYPHS.md spec.

Co-authored-by: Cursor <cursoragent@cursor.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@animata/skeleton/CATEGORY-GLYPHS.md`:
- Line 41: Update the SOFT row so the color-mix formula is unambiguous: replace
the placeholder "ink" with the actual CSS variable or add a short note mapping
the placeholder to the variable (e.g., show color-mix(in oklab, var(--cg-ink)
50%, transparent) or append “(formula shown conceptually; 'ink' =
var(--cg-ink))”) and keep the `--cg-soft` column label and description
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c15a4af-cba7-4e95-a38e-e17b0d997794

📥 Commits

Reviewing files that changed from the base of the PR and between d8bdc5a and c990bd9.

📒 Files selected for processing (2)
  • animata/skeleton/CATEGORY-GLYPHS.md
  • content/docs/contributing/category-glyphs.mdx
✅ Files skipped from review due to trivial changes (1)
  • content/docs/contributing/category-glyphs.mdx

Comment thread content/docs/contributing/category-glyphs-spec.md
sudhashrestha and others added 2 commits June 11, 2026 16:32
Webpack's lazy context for @/animata/* was picking up CATEGORY-GLYPHS.md
and failing the build. Relocate the spec to content/docs/contributing/.

Co-authored-by: Cursor <cursoragent@cursor.com>
Make the published docs self-contained, drop repo-path references,
and tighten the hover and shade copy for contributors.

Co-authored-by: Cursor <cursoragent@cursor.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
content/docs/contributing/category-glyphs-spec.md (1)

41-41: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify the color-mix formula notation.

The formula still uses "ink" as a placeholder rather than the actual CSS variable reference. Since the table shows concrete CSS variable names in other columns (--cg-ink, --cg-soft), this inconsistency may confuse readers.

📝 Suggested fix
-| **SOFT** | `--cg-soft` | `color-mix(in oklab, ink 50%, transparent)` | same formula | Supporting content — secondary bars, inactive labels, mid stack layers |
+| **SOFT** | `--cg-soft` | `color-mix(in oklab, var(--cg-ink) 50%, transparent)` | same formula | Supporting content — secondary bars, inactive labels, mid stack layers |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@content/docs/contributing/category-glyphs-spec.md` at line 41, In the table
row for the SOFT glyph, replace the placeholder "ink" in the color-mix
expression with the actual CSS variable reference so it matches other cells;
update the formula from "color-mix(in oklab, ink 50%, transparent)" to use
var(--cg-ink) (e.g., "color-mix(in oklab, var(--cg-ink) 50%, transparent)") and
ensure the column that shows the concrete CSS variable name references --cg-soft
consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@content/docs/contributing/category-glyphs-spec.md`:
- Line 41: In the table row for the SOFT glyph, replace the placeholder "ink" in
the color-mix expression with the actual CSS variable reference so it matches
other cells; update the formula from "color-mix(in oklab, ink 50%, transparent)"
to use var(--cg-ink) (e.g., "color-mix(in oklab, var(--cg-ink) 50%,
transparent)") and ensure the column that shows the concrete CSS variable name
references --cg-soft consistently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 18616183-3c6f-4aa7-8abe-5808e66b6e3a

📥 Commits

Reviewing files that changed from the base of the PR and between c990bd9 and ecd1c80.

📒 Files selected for processing (4)
  • content/docs/contributing/category-glyphs-spec.md
  • content/docs/contributing/category-glyphs.mdx
  • content/docs/contributing/components.mdx
  • content/docs/contributing/index.mdx
✅ Files skipped from review due to trivial changes (1)
  • content/docs/contributing/components.mdx

@sudhashrestha sudhashrestha merged commit df72b77 into main Jun 11, 2026
6 checks passed
@sudhashrestha sudhashrestha deleted the feat/glitch-roll-text-improvements branch June 11, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants