Animated ASCII Art for Web Pages
Article URL: https://ascii.rest/ Comments URL: https://news.ycombinator.com/item?id=49993857 Points: 264 # Comments: 56
The source material details animated ASCII art pieces available for web pages. There are 191 animated ASCII pieces in total, categorized into several types including full-color scenes, loaders, charts, type, 27 language logos, 22 Linux distros, 3D shapes, physics and creatures. Each piece is a small, typed TypeScript module without any dependencies, making it compatible with various frameworks like React, Next.js, Astro, or plain HTML pages.
The pieces are free to use and modify under the MIT license, and require no installation or build step. The code defines an ascii-art tag, loads the piece from ascii.rest, and plays it while on screen, replacing it with the first frame for those who prefer reduced motion. A client component allows for easy implementation, working seamlessly with the Next.js app router.
The piece name is passed as an argument, such as piece=donut, to fetch the piece only when it mounts. The piece renders the first frame on the server, ensuring the page is fully loaded before any script execution, and then plays the piece once it's loaded. The mount function plays the piece in a pre or canvas element for colored pieces, and returns a function to stop the animation. Every piece, option, and frame is typed for clarity and ease of use.
Rewritten by urgent.news; may contain errors — check the original.
This story
This is one outlet's version. Read the fullest account.
- Animated ASCII Art for Web Pages ascii.rest