Skip to content

feat(typed effect): add tumble typed effect (@d1rshan)#7793

Open
d1rshan wants to merge 2 commits intomonkeytypegame:masterfrom
d1rshan:feat/tumble-typed-effect
Open

feat(typed effect): add tumble typed effect (@d1rshan)#7793
d1rshan wants to merge 2 commits intomonkeytypegame:masterfrom
d1rshan:feat/tumble-typed-effect

Conversation

@d1rshan
Copy link
Copy Markdown
Contributor

@d1rshan d1rshan commented Apr 8, 2026

tumble.mp4

This PR adds a new typed effect called tumble.

When a correctly submitted word becomes typed, it creates a temporary animated clone that falls off the screen while the original word is hidden. Incorrect submitted words stay in place so error feedback remains visible.

This PR also introduces a dedicated typed-effects module for typed effects that need JavaScript behavior, so effect-specific logic does not have to live directly in test-ui.

Copilot AI review requested due to automatic review settings April 8, 2026 20:16
@monkeytypegeorge monkeytypegeorge added frontend User interface or web stuff packages Changes in local packages labels Apr 8, 2026
@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label Apr 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new tumble typed effect for the test page, with a JS-driven animation that spawns a falling clone of correctly typed words while hiding the original word.

Changes:

  • Extend typed effect config schema + settings UI to include tumble.
  • Add a new frontend/src/ts/test/typed-effects.ts module to host JS-driven typed effects (currently tumble).
  • Wire typed effect lifecycle into test-ui (trigger on word typed, clear on show/finish) and add corresponding SCSS + keyframes.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/schemas/src/configs.ts Adds tumble to TypedEffectSchema enum.
frontend/src/ts/test/typed-effects.ts Implements JS behavior for tumble (clone + fall animation + cleanup).
frontend/src/ts/test/test-ui.ts Hooks typed-effects into word-typing flow and clears clones/styles on lifecycle events.
frontend/src/styles/test.scss Adds typed-effect-tumble hiding rule + .tumble-clone animation styling.
frontend/src/styles/animations.scss Adds @keyframes typedEffectTumble.
frontend/src/html/pages/settings.html Adds tumble button to typedEffect settings.

Comment on lines +47 to +52
document.body.appendChild(clone);
word.setStyle({ opacity: "0" });

clone.addEventListener("animationend", () => {
clone.remove();
});
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

tumble-clone removal relies solely on animationend. Global @media (prefers-reduced-motion) disables animations (see styles/media-queries.scss), so animationend won’t fire and clones can accumulate + stay fixed on screen while the real word is hidden. Add a non-animation fallback (e.g., setTimeout cleanup based on duration, or immediate removal when reduced-motion is active) and consider { once: true } on the listener.

Copilot uses AI. Check for mistakes.
Comment on lines 148 to 152
if (previousActiveWord !== null) {
if (direction === "forward") {
previousActiveWord.addClass("typed");
TypedEffects.onWordTyped(previousActiveWord);
Ligatures.set(previousActiveWord, true);
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

triggerTumble hides words via inline opacity: 0. If the user changes typedEffect mid-test (changeRequiresRestart=false), those inline styles persist even after typed-effect-tumble class is removed, leaving already-typed words invisible under other effects. Consider clearing tumble inline styles (and any pending clones) on typedEffect config changes, or avoid inline opacity and rely on effect-specific CSS/classes instead.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff packages Changes in local packages waiting for review Pull requests that require a review before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants