Skip to content

Commit 39851d7

Browse files
committed
fix opacity loop not working together with other loops
1 parent 41b2ba9 commit 39851d7

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/baseAnimations.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,12 @@ export function addBaseAnimations(matchUtilities, theme) {
349349
matchUtilities(
350350
{
351351
"motion-opacity-loop": (value, { modifier }) => ({
352-
"--motion-loop-opacity": value,
352+
// we need to subtract 1 because of animation composition
353+
"--motion-loop-opacity": `${Number(value) - 1}`,
353354
"--motion-opacity-loop-animation": opacityLoopAnimation(
354355
modifier || "mirror"
355356
),
356-
// no animation composition because it makes opacity not work
357+
animationComposition: "accumulate",
357358
animation: "var(--motion-all-loop-and-enter-animations)",
358359
}),
359360
},

web/src/pages/index.astro

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
<title>Tailwind motion</title>
44
<meta charset="utf-8" />
55
</head>
6-
<body>
7-
<div
8-
class="relative text-white text-6xl flex text-center font-black justify-center items-center h-screen flex-col bg-black"
9-
>
10-
<div class="motion-preset-float">🚀</div>
11-
</div>
6+
<body
7+
class="bg-black flex justify-center items-center text-white text-9xl h-screen"
8+
>
9+
<h1 class="motion-opacity-loop-0 motion-scale-loop-50">Rombo</h1>
1210
</body>
1311
</html>

0 commit comments

Comments
 (0)