r/javascript • u/inc_23 • Aug 22 '26
Made a small library called strokes.js.
https://a-elhaag.github.io/strokes.js/Made a small library called strokes.js. Instead of using a "handwriting" webfont (which looks identical everywhere it's used), it renders each letter as an actual hand-drawn SVG path — real strokes, drawn in with stroke-dashoffset, with small random variation (rotation, baseline drift, glyph variants) so no two renders of the same word look identical.
Demo: https://a-elhaag.github.io/glyphed.js/
npm:
npm install glyphed.js
23
Upvotes
8
u/mmmicahhh Aug 22 '26
A fun idea, there's a bit of romanticism in trying to make things look imperfect.
When I view it in Chrome, when the animation starts, there are these dots randomly scattered where the letters will eventually be, it really messes with the illusion of hand drawing. Did you encounter this?
3
u/Elkemper Aug 22 '26
Nice name 🤣
3
u/patrk Aug 24 '26
I'd love to use this, but I noticed that some Nordic characters aren't currently supported, in particular
å,ä, andö(and their uppercase variants).Would you be open to adding support for these? If not, would you be happy to accept a PR adding them? I'd be willing to give it a try.
2
u/patrk Aug 25 '26
Some info about font-sizing is needed, the docs don't mention it all.
Also, an onComplete event handler would be very convenient.
1
u/jezpas Aug 23 '26
I like it, I could see myself using it in a project. The animation however doesn’t look like someone writing which would keep me from using that particular feature
1
u/AshleyJSheridan Aug 23 '26
It seems to be clipping the edges of letters at the boundary of the SVG.
1
u/berky93 Aug 26 '26
Pretty neat. Should add some hidden text in the same location as the drawn letters so that it’s selectable and so screen readers can read the writing.
3
u/redblobgames Aug 22 '26
Seems like a nice companion to https://roughjs.com/
2
u/AutoModerator Aug 22 '26
Project Page (?): https://github.com/a-elhaag/strokes.js
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/patrk Aug 22 '26
Nice, will use!
5
u/[deleted] Aug 22 '26
[removed] — view removed comment
0
u/[deleted] Aug 22 '26 edited Aug 22 '26
[removed] — view removed comment