Skip to content

Conversation

pearmini
Copy link
Collaborator

@pearmini pearmini commented Sep 27, 2025

Support snapshot thumbnail.

iShot_2025-09-27_12 11 42
/**
 * ============================================================================
 * =                         Sin Wave Radios                                  =
 * ============================================================================
 *
 * This example explores using inputs to create some visual patterns in Recho.
 * For now, we can only manually set the values of the inputs to simulate the 
 * sine wave, based on the computed values. In the future, inputs values can be
 * programmatically updated.
 */

recho.radio(4, ['','','','','','','','','']);
recho.radio(5, ['','','','','','','','','']);
recho.radio(6, ['','','','','','','','','']);
recho.radio(7, ['','','','','','','','','']);
recho.radio(8, ['','','','','','','','','']);
recho.radio(8, ['','','','','','','','','']);
recho.radio(8, ['','','','','','','','','']);
recho.radio(7, ['','','','','','','','','']);
recho.radio(6, ['','','','','','','','','']);
recho.radio(5, ['','','','','','','','','']);
recho.radio(4, ['','','','','','','','','']);
recho.radio(3, ['','','','','','','','','']);
recho.radio(2, ['','','','','','','','','']);
recho.radio(1, ['','','','','','','','','']);
recho.radio(0, ['','','','','','','','','']);
recho.radio(0, ['','','','','','','','','']);
recho.radio(0, ['','','','','','','','','']);
recho.radio(1, ['','','','','','','','','']);
recho.radio(2, ['','','','','','','','','']);
recho.radio(3, ['','','','','','','','','']);
recho.radio(4, ['','','','','','','','','']);

//➜ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]
//➜ [ 0, 0.3141592653589793, 0.6283185307179586, 0.9424777960769379, 1.2566370614359172, 1.5707963267948966, 1.8849555921538759, 2.199114857512855, 2.5132741228718345, 2.827433388230814, 3.141592653589793…
//➜ [ 4, 5, 6, 7, 8, 8, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 1, 2, 3, 4 ]
{
  const n = 20;
  const m = 8;
  const I = echo([...Array.from({length: n}, (_, i) => i), n]);
  const X = echo(I.map(i => i / n * Math.PI * 2));
  echo(X.map(x => Math.round(Math.sin(x) * m / 2 + m / 2)));
}

@cloudflare-workers-and-pages
Copy link

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

Deploying recho with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1175441
Status: ✅  Deploy successful!
Preview URL: https://9ef38320.recho.pages.dev
Branch Preview URL: https://sin-radios.recho.pages.dev

View logs

@pearmini pearmini changed the title Add sin radios [Example] Sin Wave Radios _Support snapshot thumbnail_ Sep 27, 2025
@pearmini pearmini changed the title [Example] Sin Wave Radios _Support snapshot thumbnail_ [Example] Sin Wave Radios Support snapshot thumbnail Sep 27, 2025
@pearmini pearmini changed the title [Example] Sin Wave Radios Support snapshot thumbnail [Example] Sin Wave Radios (Support snapshot thumbnail) Sep 27, 2025
@pearmini pearmini merged commit 1cdb4b6 into main Sep 27, 2025
2 checks passed
@pearmini pearmini deleted the sin-radios branch September 27, 2025 16:45
@pearmini pearmini added the Example Add a new example label Sep 27, 2025
pearmini added a commit that referenced this pull request Sep 27, 2025
* Add sin radios

* Update #PR

* Fix CI

* Update contributing
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