Skip to content

Commit

Permalink
animate instead of style, for production.
Browse files Browse the repository at this point in the history
  • Loading branch information
LutherTS committed Oct 8, 2024
1 parent 1b2029b commit 27f5fe0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/(pages)/carousel-part-cleaned/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ export default function Carousel({
objectFitting === "scroll"
? objectFittingScrollHeight
: "auto",
// animations break in production when they're on style
// x: `-${index * 100}%`, // Safari again
}}
onAnimationStart={(definition: AnimationDefinition) =>
Expand Down Expand Up @@ -614,10 +615,13 @@ export default function Carousel({
>
<motion.div
initial={false}
animate={{
x: `-${index * 100 * (collapsedAspectRatio / fullAspectRatio) + fullMargin + index * gap}%`,
}}
style={{
aspectRatio: fullAspectRatio,
gap: `${gap}%`,
x: `-${index * 100 * (collapsedAspectRatio / fullAspectRatio) + fullMargin + index * gap}%`,
// x: `-${index * 100 * (collapsedAspectRatio / fullAspectRatio) + fullMargin + index * gap}%`,
}}
className="flex min-w-0"
// https://buildui.com/recipes/animated-carousel
Expand Down

0 comments on commit 27f5fe0

Please sign in to comment.