đŸ Archived View for tilde.pink âș ~ssb22 âș script2canvas.gmi captured on 2023-09-08 at 17:04:31. Gemini links have been rewritten to link to archived content
View Raw
More Information
âŹ
ïž Previous capture (2023-01-29)
-=-=-=-=-=-=-
Typescript player for HTML5
I wrote this to make an in-browser demonstration of Primer Pooler.âIt uses code from DOStoy to display a typescript in an HTML5 canvas.
Advantages:
- The Javascript is entirely self-contained.âIt does not require any special setup on the server side and you donât have to rely on a third-party server.
- Reduces data transfer without blurring the text (although HTML5 Canvas can be blurred under *some* circumstances)
- New text stays entirely within the canvas and is not added to the web page, thus avoiding bad interactions with screenreaders and accessibility CSS
- Canvas appears only on wide screens, wonât clutter mobile devices (Iâm assuming the demonstration is non-essential)
- Animation does not start until clicked on (to avoid annoying anyone whoâs not looking at it), and can be paused/resumed at any time by clicking again
- The typescript can be viewed in the Javascript source.
Disadvantages:
- No rewind control
- Wonât stop the screensaver
- Canât copy/paste or change the font without looking at the source
- The terminal program must be simple: think *line-mode interaction with some colours*. Full-screen editors etc will not work properly (at least not without further work on the converter)
- No screen-reader accessibility.âBut as mentioned above Iâm assuming the demonstration is entirely optional; people who donât think visually shouldnât need it (I know I donât; Iâm just doing this because apparently some sighted people want it).
Download: script2canvas.py (License:Â MIT)
script2canvas.py
Usage:
1. On a GNU/Linux terminal, do script -t log2 2>log1 and record as appropriate
2. Do python script2canvas.py >demo.js
3. Optionally edit the resulting demo.js file if you want to âairbrushâ your mistakes
4. In your HTML, put:
<span id="DOStoyPlace"></span><script src="demo.js"></script>
5. Test
Legal
All material © Silas S. Brown unless otherwise stated. Javascript is a trademark of Oracle Corporation in the US. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. Any other trademarks I mentioned without realising are trademarks of their respective holders.