Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save khanh96le/bdd1364232e39799dfd4632da3d599bc to your computer and use it in GitHub Desktop.
Save khanh96le/bdd1364232e39799dfd4632da3d599bc to your computer and use it in GitHub Desktop.
Anki Chinese Back Template
<b style="font-size: 100px; font-family: Kaiti TC">
{{Hán tự}}
</b>
<hr id=answer>
<div id="target"></div>
<script type="text/javascript">
var characters = "{{Hán tự}}".split("").filter(char => char.trim() !== '');
var js = document.createElement("script");
js.type = "text/javascript";
js.src = "https://cdn.jsdelivr.net/npm/[email protected]/dist/hanzi-writer.min.js";
js.onload = function() {
for (x of characters) {
var writer = HanziWriter.create('target', x, {
width: 70,
height: 70,
padding: 0,
showOutline: true,
strokeAnimationSpeed: 1,
delayBetweenStrokes: 100, // milliseconds
radicalColor: '#337ab7' // blue
});
writer.loopCharacterAnimation();
};
};
document.body.appendChild(js);
</script>
<hr id=answer>
{{Pinyin}}
<hr id=answer>
{{Tiếng Việt}}
<hr id=answer>
<b style="font-size: 40px; font-family: Kaiti TC">
{{Example}}
</b>
<hr id=answer>
{{Audio}}{{ExampleAudio}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment