Replies: 2 comments 1 reply
-
As per the line you linked: The function expects a string, so an object would indeed produce an error as per your original post. I believe the @keyframes grow-left {
'0%' {
transform: scaleX(0.0);
transform-origin: right;
'100%' {
transform: scaleX(1.0);
transform-origin: right;
},
}, keyframes: {
'grow-left': {
'0%': {
transform: 'scaleX(0.0)',
transformOrigin: 'right'
},
'100%': {
transform: 'scaleX(1.0)',
transformOrigin: 'right'
},
},
}, But this is not the same for .animation-grow-left-noworky {
animation {
name: grow-left;
duration: 200ms;
timing-function: linear;
iteration-count: 1;
delay: 500ms;
}
} Though I presume you may wish for it to work like: .animation-grow-left-noworky {
animation-name: grow-left;
animation-duration: 200ms;
animation-timing-function: linear;
animation-iteration-count: 1;
animation-delay: 500ms;
} Or for Tailwind to flatten the object down all the way down to a single
"Obvious" is a matter of perspective, though I'd say in the utility-based paradigm of Tailwind, there isn't much benefit than to have it in a single If you really wanted the object-based version in your configuration, you could consider flattening the object yourself like: 'grow-left-noworky':
Object.values({
name: 'grow-left',
duration: '200ms',
timingFunction: 'linear',
iterationCount: '1',
delay: '500ms'
}).join(' '), Though again, if your point is that Tailwind should do this for you, I feel like this post would have been more appropriate as an 💡Idea post, rather than a 🙏Help post. |
Beta Was this translation helpful? Give feedback.
-
The For example, if we did it for animations, why not do it for box shadows? boxShadow: {
md: [
{
x: "0",
y: "4px",
blur: "6px",
spread: "-1px",
color: "rgb(0 0 0 / 0.1)",
},
{
x: "0",
y: "2px",
blur: "4px",
spread: "-2px",
color: "rgb(0 0 0 / 0.1)",
},
],
} TL;DR though the answer to your question is just "because that's what CSS does for that property" 👍 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
so... perhaps I'm just odd;
however I was trying to extend my theme's animation declarations:
tailwind.config.js
:results in:
Which afaict is referring to this line in parseAnimationValue.js1... My question is
Shouldn't one be able to explicitly declare the parameters of an animation, given that the same declaration format is encouraged for keyframes?
From my perspective, it seems like a nice bit of sugar to permit the user to just throw a pile of attributes at the parser and expect it to 'do what I mean' .... (thank you, it really is quite pleasant and friendly)
but I fail to see the downside to of supporting, if not actively encouraging the equivalent declaration syntax of related properties...
I'd imagine it would be (admittedly marginally) faster to consume a blob of kv pairs as named than trying to iteratively invoke voodoo against (reasonably predictable) values and hoping for a match...
Am I missing something really obvious?
Footnotes
https://github.com/tailwindlabs/tailwindcss/blob/master/src/util/parseAnimationValue.js#L22 ↩
Beta Was this translation helpful? Give feedback.
All reactions