A stroke drawing React component for zh-stroke-data.
Install with following commands.
npm install react-zh-stroker
# or
yarn add react-zh-strokerreact-zh-stroker is designed to draw JSON stroke data from 常用國字標準字體筆順學習網,
which are processed and stored in zh-stroke-data.
For example, if you want to draw 萌 (json/840c.json) in your app:
import { data, Word } from 'react-zh-stroker';
import word from './json/840c.json';
const moe = data.computeLength(word);
function App() {
return (
<Word data={moe} progress={1.0} />
);
}By changing the progress property dynamically, you can animate the word.
Check this example for more information.
Word draws a JSON stroke data.
onEnter is triggered when a word is starting to draw.
onLeave is triggered when a word is finishing to draw.
onEnterStroke is triggered when a stroke in a word is starting to draw.
onLeaveStroke is triggered when a stroke in a word is finishing to draw.
Stroke draws a stroke in a JSON stroke data.
Track draws a path.
data.fromXML is a helper to read a stroke data in XML format.
data.packedFromPath is a helper to compute the index of a word in a packed binary stroke data.
data.fromBinary is a helper to read a stroke data in binary format.
data.fromScanline is a helper to read a stroke data in scanline format.
data.computeLength is a helper to compute the length of a word.
yarn install
yarn start

To the extent possible under law,
caasi Huang
has waived all copyright and related or neighboring rights to
react-zh-stroker.