@utility for creating to modify the repeat count of pre-declared animations #17658
-
I wanted to declare a @utility animate-repeat-* {
--animate-repeat-count: --value(integer);
}
@utility animate-repeat-infinite {
--animate-repeat-count: infinite;
} However, when I declare the animation in .animate-bounce {
animation: var(--animate-bounce);
} The problem here is that even though I override the value of ![]() ![]() If I declare the animation in Naturally, without ![]() ![]() How can I make the animation declared in @theme {
--animate-bounce: bounce 1s var(--animate-repeat-count, infinite);
}
@utility animate-repeat-* {
--animate-repeat-count: --value(integer);
}
@utility animate-repeat-infinite {
--animate-repeat-count: infinite;
} <div class="p-10 text-center">
<button class="mx-auto animate-bounce bg-green-300 px-8 py-2 animate-repeat-2">
Bounce animation repeated 2 times in 1s.
</button>
</div> |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You could consider using |
Beta Was this translation helpful? Give feedback.
You could consider using
@theme inline
. This ensures the--animate-repeat-count
is resolved from the element where theanimate-bounce
class name is used on.https://play.tailwindcss.com/56U1WJ4K72?file=css