Skip to content

Conversation

pearmini
Copy link
Collaborator

@pearmini pearmini commented Sep 9, 2025

/**
 * ============================================================================
 * =                            Running Race                                  =
 * ============================================================================
 *
 * This is a tiny demo that shows how to use `recho.interval` to create
 * animations in Recho. It's inspired by the **hello world** example from
 * VanJs: https://vanjs.org/demo#hello-world
 */

const snail = recho.interval(2000);
const turtle = recho.interval(1000);
const human = recho.interval(500);
const car = recho.interval(10);
const rocket = recho.interval(2);

//➜                                    🐌💨
//➜                                   🐢💨
//➜                              🚶‍♂️💨
//➜                     🚗💨
//➜           🚀💨
{
  const x = (count) => 40 - (count % 40);
  echo("🐌💨".padStart(x(snail)), {quote: false});
  echo("🐢💨".padStart(x(turtle)), {quote: false});
  echo("🚶‍♂️💨".padStart(x(human)), {quote: false});
  echo("🚗💨".padStart(x(car)), {quote: false});
  echo("🚀💨".padStart(x(rocket)), {quote: false});
}

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 9, 2025

Deploying recho with  Cloudflare Pages  Cloudflare Pages

Latest commit: fd9931b
Status: ✅  Deploy successful!
Preview URL: https://bf7b50c4.recho.pages.dev
Branch Preview URL: https://example-running-race.recho.pages.dev

View logs

@pearmini pearmini merged commit 7a2e816 into main Sep 9, 2025
2 checks passed
@pearmini pearmini deleted the example-running-race branch September 9, 2025 22:13
@pearmini pearmini added the Example Add a new example label Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Example Add a new example

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant