Skip to content

implemented UI for animation system#554

Open
mariotee wants to merge 1 commit intomainfrom
feat/animation-system-ui
Open

implemented UI for animation system#554
mariotee wants to merge 1 commit intomainfrom
feat/animation-system-ui

Conversation

@mariotee
Copy link
Copy Markdown
Collaborator

feat: added defeat animations for units and upgrades

feat: added animation for shield breaks

chore: prep for animations prefs

feat: added animations tab

feat: added healing animation

Conflicts:

src/app/_components/_sharedcomponents/Cards/GameCard.tsx

feat: added defeat animations for units and upgrades

feat: added animation for shield breaks

chore: prep for animations prefs

feat: added animations tab

feat: added healing animation

# Conflicts:
#	src/app/_components/_sharedcomponents/Cards/GameCard.tsx
// (these animations need the elements to still be in DOM)
if ((hasDefeatAnimations || hasShieldAnimations) && gameState.animations) {
try {
await processAnimations(gameState.animations);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of making this function async and just awaiting the animation instead of trying to juggle pre and post animation game states so thats nice.

I think what might be better here though is to have a property on events that mark them as pre or post update and then disambiguate here. That way the BE can just tell us where in the timeline each event should be rendered. We might also need to tell the manager which animations to process in each window. I'm not sure if we might ahve some events that would require an update before AND after update. Perhaps on a When defeated trigger?

<Box
sx={styles.card}
onClick={handleClick}
onMouseEnter={handlePreviewOpen}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a bad merge here? I think these were moved down a layer to prevent the preview popup from showing when suing teh distribute controls.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see.. and i needed them up a layer due to the defeat animation showing the black box behind it. i'll revert this and then put some styling to make that box transparent

@danbastin
Copy link
Copy Markdown
Contributor

Just a couple quick comments here mainly concerning about how we're receiving and processing animation events from the BE. Talekd to Veld and I think we're gonna just try to iron out the event delivery first and then I'll have some time this week to take a closer look at the actual animation part.

/**
* Optimizes the queue by combining duplicate events.
*/
private optimizeQueue(): void {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we doing this on the BE already?

// Damage animations will execute first due to higher priority (90 vs 85)

const hasDefeatAnimations = gameState.animations?.events?.some(
(event: any) => event.type === 'DEFEAT'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same note as on the BE, we prefer to use the enum types instead of the string value

}
});

const [fastAnimations, setFastAnimations] = useState<boolean>(() => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't tell if animation speed being a boolean makes this more clean and readable, or a little confusing.

}
};

element.addEventListener('animationend', handleAnimationEnd, { once: true });
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid use of vanilla JS stuff in these executors

}
}

/* Top left piece */
Copy link
Copy Markdown
Collaborator

@ejmudrak ejmudrak Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shrapnel shield defeat looks good! I think shrapnel's CSS animation code here makes sense too, so the more intricate animation is worth having imo.

border-color: rgba(0, 140, 255, 0.4);
box-shadow: 0 0 4px rgba(0, 140, 255, 0.4);
}
`;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any shared/global CSS or animations defined in this codebase? I see that this pulseBorder animation's code is duplicated for each settings page at least.

Standardizing and having a source of truth for styles is something that I'd be willing to take on sometime.

label={
<Box>
<Typography variant="body1" fontWeight="bold">Show Only Damage Animations</Typography>
<Typography variant="body2" color="text.secondary">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These subtitle Typography components need to have a different color, they're currently defaulting to black and indistinguishable from the background

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

color: '#878787' is what the other tabs are using. The theme could be updated to use that color as text.secondary too.

Copy link
Copy Markdown
Collaborator

@ejmudrak ejmudrak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm new to this codebase, but some really exciting changes here. Especially for new players (like myself) that may feel like "wait wtf just happened" when an action is made against one of my units. Good stuff here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants