skishore / makemeahanzi

Free, open-source Chinese character data
https://www.skishore.me/makemeahanzi/
Other
1.87k stars 466 forks source link

Support of how to use the data to get SVG file #78

Closed EagleVee closed 4 years ago

EagleVee commented 4 years ago

I'm sorry for asking this dumb question. I'm trying to create a React Native app, so I can't really use the hanzi-writer javascript library of @chanind. I can't seem to figure out how you get the right svg for each character using graphics.txt or dictionary.txt. Thanks in advance.

EagleVee commented 4 years ago

Well, when you are sleepy your brain really becomes dumb. I just read the README and this instantly show up :)

As an experimental next step, we have produced an animated SVG image for each character that we have data for (see the svgs directory). The SVGs are named by the Unicode codepoint of the character they correspond to. Using Javascript, you can find the codepoint of a character x by calling x.charCodeAt(0). It's easy to embed these SVGs in a website. A minimal example is as follows:

This feature is experimental because it is still tricky to work with these images beyond this basic example. For instance, it's not clear how to embed two of these images side-by-side and have the second start animating when the first is complete. However, the images are still the easiest way to make use of this data..