Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions app/examples/running-race.recho.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* @title Running Race
* @author Bairui Su
* @created 2025-09-09
* @pull_request 82
* @github pearmini
* @thumbnail_start 26
*/

/**
* ============================================================================
* = 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});
}