skishore / makemeahanzi

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

Is there any way to loop the svg files? #67

Closed d3rped closed 4 years ago

d3rped commented 5 years ago

Use Case: I wrote a small python script to generate anki flashcard decks from org-mode tables. It embeds the relevant svg's in the answer answer section of said flashcards.

My Issue: Because I'm not really familiar with JavaScript (afaik js can be used in anki) nor with svg's I'm not quite sure how to do it. I've had a look at the svg file format specification but did not make any real progress. I suppose I need to extend the duration of each animation and modify the keyframes accordingly. Is there a way for me to automagically patch the files so that the animation loops?

PatrickMalolepszy commented 5 years ago

Hey @d3rped, I am in the same situation.

I want to automate my Anki card creation.

I have found some information on repeating animations in svg, but it does not seem like this applies to the files in this repo.

https://codepen.io/danjiro/post/how-to-make-svg-loop-animation

Have you found anything since?

mattbenscho commented 5 years ago

I once created an Anki deck using this data to practice writing Chinese characters and had a looping animation on the back site of the cards. Check out my blog entry: http://abananablog.com/2016/12/31/anki-trace/

d3rped commented 4 years ago

@PatrickMalolepszy not sure if this is at all relevant to you anymore but here is what I've ended up doing: Because it's too much of a pain to alter svg's with multiple keyframes I ended up using hanzi-writer (a js library which makes use of this project and is even linked in the README file). Even though I don't know anything about javascript it was pretty easy to implement (though it resulted in what I can only describe as the ugliest bit of code (mangled mess of js with interspersed bits of python would describe it better) I've ever written).

Plus it comes with nice features like a Quiz function. (makes it a lot easier to practice on the go)