chinese-support-redux
chinese-support-redux copied to clipboard
Add stroke order animation field
Original request: https://github.com/ttempe/chinese-support-addon/issues/68
Is this just downloading a bunch of free images with gifs and then get it to autofill depending on the Hanzi field? Have you thought about how the solution would look?
Pretty much, I think. The solution would be to have a mapping of Unicode character -> filename, which is probably work that has already been done. Licensing would be the only thing to check.
There is a project called hanzi-writer https://github.com/chanind/hanzi-writer You could implement the package like the implementation of mathjax for latex in anki. Basically the javascript package renders the stroke order. I would suggest you have a tag like:
[strokeorder]我[/strokeorder]
and then it renders the sign.
Have a look at the demo: https://hanziwriter.org/demo.html
I would have a look into that and make a pull request. @luoliyan are you open for that?
I added this for myself and wanted to share it, this probably isn't the cleanest way to do it but I just needed it to work (I am not sure if the config.json modification is conform to your style, let me know): https://github.com/benediktdreher/chinese-support-redux/commit/fc0d9c3a394f20fddeb57dd4c058bd4ed4526785 If the code is fine by you, I can open a PR. If not, this is a little hack for people who want it.
Usage: Create one or more fields "Stroke Order 1", "Stroke Order 2", etc. depending on how many characters in one word you want to allow, I left it at 4. Type in the Hanzi and hit Tab as usual. I fetch the .gif animation from an online resource: http://bishun.strokeorder.info/mandarin.php and paste the image source in, similar to how the TTS fetch works.
Here it is in action:
are you still working on this?