Skip to content

Commit

Permalink
fix: improved image choice animations to ensure they occur after the …
Browse files Browse the repository at this point in the history
…images are loaded
  • Loading branch information
agrattan0820 committed Jul 26, 2024
1 parent 0bc997b commit 243d2c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions apps/client/src/components/game/face-off-result-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ const FaceOffResultImage = ({
return (
<motion.figure
layout="position"
initial={false}
initial="hidden"
animate={
isWinner
? "winner"
: isLoser
? "loser"
: bothImagesShown
? "visible"
: "hidden"
? "loser"
: bothImagesShown
? "visible"
: "hidden"
}
variants={imageVariants}
transition={{ when: "beforeChildren" }}
Expand Down Expand Up @@ -198,8 +198,8 @@ const FaceOffResultImage = ({
src={image}
alt={`AI-generated image with the prompt: ${prompt}`}
onLoad={() => setShowImage(true)}
width={1024}
height={1024}
width={768}
height={768}
/>
<motion.ul
initial={false}
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/game/image-choice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const ImageChoiceOption = ({

return (
<motion.div
initial={false}
initial="hidden"
animate={bothShown ? "visible" : "hidden"}
variants={variants}
>
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/components/game/leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ const Leaderboard = ({
<img
className="aspect-square"
src={generation.generation.imageUrl}
width={1024}
height={1024}
width={768}
height={768}
alt={`Image generated with the prompt: ${generation.generation.text}`}
/>
<p className="absolute -left-1 -top-1 max-w-[160px] rounded-b-md rounded-r-md bg-slate-800/75 py-1 pb-2 pl-3 pr-2 pt-3 text-white">
Expand Down

0 comments on commit 243d2c4

Please sign in to comment.