UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
🐛 fix: fix shimmer style
Dillion Vermaa7ea129c9ac0
diff --git a/content/components/shimmer-button.mdx b/content/components/shimmer-button.mdxindex 1006c74c..e413bbdb 100644--- a/content/components/shimmer-button.mdx+++ b/content/components/shimmer-button.mdx@@ -1,7 +1,7 @@---title: Shimmer Buttondate: 2023-08-10-summary: A button with a shimmering light which travels around the perimeter of the button.+summary: A button with a shimmering light which travels around the perimeter.author: dillionvermapublished: truevideo: https://cdn.magicuikit.com/shimmer.mp4@@ -37,16 +37,27 @@ module.exports = {theme: {extend: {animation: {- flip: "flip calc(var(--spark) * 2) infinite steps(2, end)",- rotate: "rotate var(--spark) linear infinite both;",+ spin: "spin calc(var(--speed) * 2) infinite linear",+ slide: "slide var(--speed) ease-in-out infinite alternate",},keyframes: {- flip: {- to: { rotate: "360deg" },+ spin: {+ "0%": {+ rotate: "0deg",+ },+ "15%, 35%": {+ rotate: "90deg",+ },+ "65%, 85%": {+ rotate: "270deg",+ },+ "100%": {+ rotate: "360deg",+ },},- rotate: {+ slide: {to: {- transform: "rotate(90deg)",+ transform: "translate(calc(100cqw - 100%), 0)",},},},diff --git a/registry/components/magicui/shimmer-button.tsx b/registry/components/magicui/shimmer-button.tsxindex 41e0e0fc..60108b02 100644--- a/registry/components/magicui/shimmer-button.tsx+++ b/registry/components/magicui/shimmer-button.tsx@@ -7,7 +7,7 @@ interface ShimmerButtonProps {shimmerColor?: string;shimmerSize?: string;borderRadius?: string;- sparkDuration?: string;+ shimmerDuration?: string;background?: string;className?: string;children?: React.ReactNode;@@ -18,8 +18,8 @@ const ShimmerButton = ({shadowEnabled = true,shimmerColor = "#ffffff",shimmerSize = "0.1em",+ shimmerDuration = "1.5s",borderRadius = "100px",- sparkDuration = "1.8s",background = "radial-gradient(ellipse 80% 50% at 50% 120%,rgba(62, 61, 117),rgba(13, 13, 33))",className,children,@@ -28,9 +28,10 @@ const ShimmerButton = ({<buttonstyle={{+ "--spread": "90deg","--shimmer-color": shimmerColor,"--radius": borderRadius,- "--spark": sparkDuration,+ "--speed": shimmerDuration,"--cut": shimmerSize,"--bg": background,"--shadow": shadow,@@ -44,10 +45,14 @@ const ShimmerButton = ({)}>{/* spark container */}- <div className="absolute inset-0 rotate-0 animate-flip overflow-hidden [border-radius:var(--radius)] [container-type:size] [mask:linear-gradient(white,transparent_50%)] ">- {/* spark before */}- <div className="absolute -z-[1] w-[200%] rotate-0 animate-rotate transition-all [aspect-ratio:1] [background:conic-gradient(from_0deg,transparent_0_340deg,var(--shimmer-color)_360deg)] [inset:0_auto_auto_50%] [transform:rotate(-90deg)] [translate:-50%_-15%] group-hover:opacity-40" />+ <div className="absolute inset-0 overflow-visible [container-type:size]">+ {/* spark */}+ <div className="absolute inset-0 h-[100cqh] animate-slide [aspect-ratio:1] [border-radius:0] [mask:none] ">+ {/* spark before */}+ <div className="absolute inset-[-100%] w-auto rotate-0 animate-spin [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,hsl(0_0%_100%/1)_var(--spread),transparent_var(--spread))] [translate:0_0]" />+ </div></div>+{/* backdrop */}<div className="absolute [background:var(--bg)] [border-radius:var(--radius)] [inset:var(--cut)]" />{/* content */}diff --git a/tailwind.config.ts b/tailwind.config.tsindex 5fb9510f..a2703bf6 100644--- a/tailwind.config.ts+++ b/tailwind.config.ts@@ -67,7 +67,9 @@ module.exports = {grid: "grid 15s linear infinite",marquee: "marquee var(--duration) linear infinite",flip: "flip calc(var(--spark) * 2) infinite steps(2, end)",- rotate: "rotate var(--spark) linear infinite both;",+ rotate: "rotate var(--spark) linear infinite both",+ spin: "spin calc(var(--speed) * 2) infinite linear",+ slide: "slide var(--speed) ease-in-out infinite alternate",},keyframes: {"accordion-down": {@@ -108,6 +110,25 @@ module.exports = {transform: "rotate(90deg)",},},+ spin: {+ "0%": {+ rotate: "0deg",+ },+ "15%, 35%": {+ rotate: "90deg",+ },+ "65%, 85%": {+ rotate: "270deg",+ },+ "100%": {+ rotate: "360deg",+ },+ },+ slide: {+ to: {+ transform: "translate(calc(100cqw - 100%), 0)",+ },+ },},},},