Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Add to the relevant `YYYY-MM.mdx` file. No need to touch the index unless the su
animata/ # Component source (copy-paste friendly)
skeleton/
category-glyphs.tsx # /components tile SVG pictograms (GLYPHS map)
category-glyphs.css # cg-motion base + keyframes (hover transforms live in TSX)
category-glyphs.css # cg-motion base + SVG scale/rotate hover exceptions
category-skeleton.tsx # Tile frame + shade tokens
container/ # Layout wrappers (marquee, dock, ribbon…)
text/ # Text animation effects
Expand Down
112 changes: 64 additions & 48 deletions animata/skeleton/category-glyphs.css
Original file line number Diff line number Diff line change
@@ -1,64 +1,19 @@
@reference "../../styles/globals.css";

@theme inline {
@keyframes cg-ping {
0%,
100% {
transform: scale(1);
}
50% {
transform: scale(1.12);
}
}

@keyframes cg-bounce {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(2.5px);
}
}

@keyframes cg-shimmer {
0%,
100% {
opacity: 0.45;
}
50% {
opacity: 1;
}
}

@keyframes cg-twinkle {
0%,
100% {
transform: scale(1) rotate(0deg);
}
50% {
transform: scale(1.25) rotate(20deg);
}
}

--animate-cg-ping: cg-ping 1.4s cubic-bezier(0.22, 1, 0.36, 1) infinite;
--animate-cg-bounce: cg-bounce 1s ease-in-out infinite;
--animate-cg-shimmer: cg-shimmer 1.2s ease-in-out infinite;
--animate-cg-twinkle: cg-twinkle 0.9s ease-in-out infinite;
}

/** Category glyph SVG — shared motion base (pair with group/cg + group-hover/cg:* on parts). */
.cg-motion {
transform-box: fill-box;
transform-origin: center;
}

@media (prefers-reduced-motion: no-preference) {
/* TW v4 utilities animate translate/scale/rotate — not transform alone */
/* TW v4 utilities use individual transform properties — transition each one */
.cg-motion {
transition:
translate 0.5s cubic-bezier(0.22, 1, 0.36, 1),
scale 0.5s cubic-bezier(0.22, 1, 0.36, 1),
scale-x 0.5s cubic-bezier(0.22, 1, 0.36, 1),
scale-y 0.5s cubic-bezier(0.22, 1, 0.36, 1),
rotate 0.5s cubic-bezier(0.22, 1, 0.36, 1),
transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
fill 0.5s ease,
Expand Down Expand Up @@ -109,3 +64,64 @@
transition: none;
}
}

/**
* SVG scale-x / scale-y exceptions — TW v4 longhands fail on stroke paths and
* bottom-anchored rects; unified transform here. animate-cg-* tokens + keyframes
* live in globals.css (@theme inline in this file does not emit TW utilities).
*/
@media (prefers-reduced-motion: no-preference) {
.cg-text-line {
transform-origin: left center;
}
.group\/cg:hover .cg-text-line-1 {
transform: scaleX(1.25);
}
.group\/cg:hover .cg-text-line-2 {
transform: scaleX(1.5);
transition-delay: 60ms;
}
.group\/cg:hover .cg-text-line-3 {
transform: scaleX(1.8);
transition-delay: 120ms;
}

.cg-list-bar {
transform-origin: left center;
}
.group\/cg:hover .cg-list-grow {
transform: scaleX(1.3);
}
.group\/cg:hover .cg-list-shrink {
transform: scaleX(0.7);
}

.cg-graph-bar {
transform-origin: center bottom;
}
.group\/cg:hover .cg-graph-bar {
transform: scaleY(1.18);
}
.group\/cg:hover .cg-graph-bar-2 {
transition-delay: 50ms;
}
.group\/cg:hover .cg-graph-bar-3 {
transition-delay: 100ms;
}
.group\/cg:hover .cg-graph-bar-4 {
transition-delay: 150ms;
}

.cg-widget-hour {
transform-origin: center bottom;
}
.cg-widget-minute {
transform-origin: 0% 0%;
}
.group\/cg:hover .cg-widget-hour {
transform: rotate(30deg);
}
.group\/cg:hover .cg-widget-minute {
transform: rotate(60deg);
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
60 changes: 24 additions & 36 deletions animata/skeleton/category-glyphs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* category so users can recognize it at a glance.
*
* Shading uses three tokens on the parent SVG (--cg-ink / --cg-soft / --cg-faint).
* Hover micro-interactions use Tailwind on each part; ancestor must be `group/cg`.
* Hover micro-interactions: default is Tailwind `group-hover/cg:*` on each part
* (ancestor must be `group/cg`). Four glyphs use CSS scale/rotate exceptions in
* category-glyphs.css; keyframe tokens live in styles/globals.css @theme.
*/

import type { ReactNode } from "react";
Expand Down Expand Up @@ -71,27 +73,21 @@ const GLYPHS: Record<string, ReactNode> = {
stroke={SOFT}
strokeWidth="2.2"
strokeLinecap={CAP}
className={cn("cg-motion", "origin-left motion-safe:group-hover/cg:scale-x-125")}
className={cn("cg-motion", "cg-text-line", "cg-text-line-1")}
/>
<path
d="M37 30 H46"
stroke={SOFT}
strokeWidth="2.2"
strokeLinecap={CAP}
className={cn(
"cg-motion",
"origin-left motion-safe:group-hover/cg:scale-x-150 motion-safe:group-hover/cg:delay-[60ms]",
)}
className={cn("cg-motion", "cg-text-line", "cg-text-line-2")}
/>
<path
d="M37 38 H43"
stroke={FAINT}
strokeWidth="2.2"
strokeLinecap={CAP}
className={cn(
"cg-motion",
"origin-left motion-safe:group-hover/cg:scale-x-[1.8] motion-safe:group-hover/cg:delay-[120ms]",
)}
className={cn("cg-motion", "cg-text-line", "cg-text-line-3")}
/>
</>
),
Expand Down Expand Up @@ -196,13 +192,7 @@ const GLYPHS: Record<string, ReactNode> = {
height="3.5"
rx="1.75"
fill={String(shade)}
className={cn(
"cg-motion",
"origin-left",
i < 2
? "motion-safe:group-hover/cg:scale-x-[1.3]"
: "motion-safe:group-hover/cg:scale-x-[0.7]",
)}
className={cn("cg-motion", "cg-list-bar", i < 2 ? "cg-list-grow" : "cg-list-shrink")}
/>
</g>
))}
Expand Down Expand Up @@ -406,7 +396,8 @@ const GLYPHS: Record<string, ReactNode> = {
strokeWidth="1.6"
className={cn(
"cg-motion-frame",
"motion-safe:group-hover/cg:animate-cg-ping motion-safe:group-hover/cg:[animation-delay:0.3s]",
"motion-safe:group-hover/cg:animate-cg-ping",
"motion-safe:group-hover/cg:[animation-delay:0.3s]",
)}
/>
<circle
Expand All @@ -418,7 +409,8 @@ const GLYPHS: Record<string, ReactNode> = {
strokeWidth="2"
className={cn(
"cg-motion-frame",
"motion-safe:group-hover/cg:animate-cg-ping motion-safe:group-hover/cg:[animation-delay:0.15s]",
"motion-safe:group-hover/cg:animate-cg-ping",
"motion-safe:group-hover/cg:[animation-delay:0.15s]",
)}
/>
<circle
Expand Down Expand Up @@ -514,13 +506,7 @@ const GLYPHS: Record<string, ReactNode> = {
height={Number(h)}
rx="2"
fill={String(shade)}
className={cn(
"cg-motion",
"origin-[center_bottom] motion-safe:group-hover/cg:scale-y-[1.18]",
i === 1 && "motion-safe:group-hover/cg:delay-[50ms]",
i === 2 && "motion-safe:group-hover/cg:delay-100",
i === 3 && "motion-safe:group-hover/cg:delay-150",
)}
className={cn("cg-motion", "cg-graph-bar", `cg-graph-bar-${i + 1}`)}
/>
))}
<rect x="12" y="47" width="40" height="2" rx="1" fill={FAINT} />
Expand Down Expand Up @@ -626,17 +612,14 @@ const GLYPHS: Record<string, ReactNode> = {
stroke={INK}
strokeWidth="2.2"
strokeLinecap={CAP}
className={cn(
"cg-motion",
"origin-[center_bottom] motion-safe:group-hover/cg:rotate-[30deg]",
)}
className={cn("cg-motion", "cg-widget-hour")}
/>
<path
d="M32 32 L37 35"
stroke={SOFT}
strokeWidth="2"
strokeLinecap={CAP}
className={cn("cg-motion", "origin-[0%_0%] motion-safe:group-hover/cg:rotate-[60deg]")}
className={cn("cg-motion", "cg-widget-minute")}
/>
<circle cx="32" cy="32" r="1.4" fill={INK} />
</>
Expand Down Expand Up @@ -841,7 +824,8 @@ const GLYPHS: Record<string, ReactNode> = {
fill={SOFT}
className={cn(
"cg-motion-frame",
"motion-safe:group-hover/cg:animate-cg-shimmer motion-safe:group-hover/cg:[animation-delay:0.1s]",
"motion-safe:group-hover/cg:animate-cg-shimmer",
"motion-safe:group-hover/cg:[animation-delay:0.1s]",
)}
/>
<rect
Expand All @@ -853,7 +837,8 @@ const GLYPHS: Record<string, ReactNode> = {
fill={FAINT}
className={cn(
"cg-motion-frame",
"motion-safe:group-hover/cg:animate-cg-shimmer motion-safe:group-hover/cg:[animation-delay:0.2s]",
"motion-safe:group-hover/cg:animate-cg-shimmer",
"motion-safe:group-hover/cg:[animation-delay:0.2s]",
)}
/>
<rect
Expand All @@ -865,7 +850,8 @@ const GLYPHS: Record<string, ReactNode> = {
fill={SOFT}
className={cn(
"cg-motion-frame",
"motion-safe:group-hover/cg:animate-cg-shimmer motion-safe:group-hover/cg:[animation-delay:0.3s]",
"motion-safe:group-hover/cg:animate-cg-shimmer",
"motion-safe:group-hover/cg:[animation-delay:0.3s]",
)}
/>
<rect
Expand All @@ -877,7 +863,8 @@ const GLYPHS: Record<string, ReactNode> = {
fill={SOFT}
className={cn(
"cg-motion-frame",
"motion-safe:group-hover/cg:animate-cg-shimmer motion-safe:group-hover/cg:[animation-delay:0.4s]",
"motion-safe:group-hover/cg:animate-cg-shimmer",
"motion-safe:group-hover/cg:[animation-delay:0.4s]",
)}
/>
<rect
Expand All @@ -889,7 +876,8 @@ const GLYPHS: Record<string, ReactNode> = {
fill={FAINT}
className={cn(
"cg-motion-frame",
"motion-safe:group-hover/cg:animate-cg-shimmer motion-safe:group-hover/cg:[animation-delay:0.5s]",
"motion-safe:group-hover/cg:animate-cg-shimmer",
"motion-safe:group-hover/cg:[animation-delay:0.5s]",
)}
/>
</>
Expand Down
16 changes: 16 additions & 0 deletions animata/skeleton/category-skeleton.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ export const Text: Story = {
args: { variant: "text", className: "w-80" },
};

export const List: Story = {
args: { variant: "list", className: "w-80" },
};

export const Icon: Story = {
args: { variant: "icon", className: "w-80" },
};

export const Graphs: Story = {
args: { variant: "graphs", className: "w-80" },
};

export const Skeleton: Story = {
args: { variant: "skeleton", className: "w-80" },
};

export const Background: Story = {
args: { variant: "background", className: "w-80" },
};
Expand Down
Loading