Skip to content

Commit

Permalink
Feat animate (#155)
Browse files Browse the repository at this point in the history
* animate

* fix playerlist

* fix battle hp
  • Loading branch information
aLIEzsss4 authored Sep 4, 2023
1 parent 24cd37e commit 3a8fb6c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/client/src/hooks/useChessboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ const useChessboard = () => {
enemy: isEnemy,
image: getHeroImg(piece.creatureId),
tier: getHeroTier(piece.creatureId),
...piece,
...creature,
...piece,
maxHealth: creature?.health,
});
}
Expand Down
22 changes: 22 additions & 0 deletions packages/client/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
@tailwind components;
@tailwind utilities;

@keyframes shake-horizontal {
0% {
transform: translateX(0);
}
25% {
transform: translateX(-5px);
}
50% {
transform: translateX(0);
}
75% {
transform: translateX(5px);
}
}

.animate-shake-horizontal {
animation-name: shake-horizontal;
animation-duration: 0.4s;
animation-timing-function: ease-in-out;
animation-delay: 0.2s;
}

.shop-modal {
.ant-card-body {
padding: 2px !important;
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/ui/Chessboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const Chessboard = () => {
{squares[i] && percent ? (
<DragItem key={i} data={squares[i]}>
<Tooltip title={showHP}>
<div className="relative">
<div className="relative animate-shake-horizontal">
<div className=" absolute -top-5 -left-1">
<Progress
status="active"
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/ui/Playlist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const PlayerList: React.FC = () => {
<div className="playerList fixed right-4 top-[120px]">
<div className="playerList-tit mx-[10px]">Players Info</div>
{playerListData?.map((player) => {
const isCurrentUser = player.id.toLocaleLowerCase() === currentUserId;
const isCurrentUser =
player.id.toLocaleLowerCase() === currentUserId.toLocaleLowerCase();
const healthPercentage = (player.hp / player.maxHp) * 100;
return (
<div
Expand Down

0 comments on commit 3a8fb6c

Please sign in to comment.