Write a more proper README
This commit is contained in:
parent
5750bb8177
commit
a4529e8aa1
1 changed files with 60 additions and 1 deletions
61
README.md
61
README.md
|
@ -1,3 +1,62 @@
|
|||
# kanjivg-tools
|
||||
|
||||
Various utilities for working with the kanjivg dataset.
|
||||
WIP
|
||||
|
||||
## Kanimaji & KanimajiTool
|
||||
|
||||
This is a library & program pair that implements CSS animations for SVG files in the KanjiVG
|
||||
dataset, roughly based on the original [kanimaji.py](https://github.com/maurimo/kanimaji) script
|
||||
([mirror](https://code.3011.io/Mirrors/kanimaji)).
|
||||
|
||||
The program is just a dead simple executable driver for the library.
|
||||
This project is currently still work in progress, but it is feature complete, and no major changes
|
||||
are expected in the public API (apart for error handling).
|
||||
|
||||
### Library usage
|
||||
|
||||
In the simplest usecase, the library consists of just two public functions:
|
||||
```cpp
|
||||
void AnimateFile(const Path& source, const Path& destination,
|
||||
const AnimationSettings& settings = AnimationSettings::Default());
|
||||
|
||||
std::string Animate(const std::string& source,
|
||||
const AnimationSettings& settings = AnimationSettings::Default());
|
||||
```
|
||||
|
||||
The former function takes in two paths, where the first one specifies the file to be read, and
|
||||
the second one specified a path where the resulting animated SVG image shoule be stored.
|
||||
|
||||
The latter takes in a string that already contains the SVG kanji data, and returns a string
|
||||
containing the animated SVG file. This function performs all operations in memory.
|
||||
|
||||
The default settings (currently) approximate the default settings in the kanimaji.py script.
|
||||
In case these are not desired, it is possible to configure the animation to an extent, e.g. like
|
||||
this:
|
||||
```cpp
|
||||
AnimateFile("084b8.svg", "084b8-out.svg", AnimationSettings {
|
||||
.StrokeProgression = Progression::EaseInOut,
|
||||
.UnfilledStroke = StrokeStyle {
|
||||
.Width = 2.0,
|
||||
.Colour = RGB::FromHex("#EEEEEE"),
|
||||
},
|
||||
.FilledStroke = StrokeStyle {
|
||||
.Width = 3.0,
|
||||
.Colour = RGB::FromHex("#000000"),
|
||||
},
|
||||
.StrokeFillingColour = RGB::FromHex("#FF0000"),
|
||||
.EnableBrush = Flag::Enable,
|
||||
.Brush = StrokeStyle {
|
||||
.Width = 5.5,
|
||||
.Colour = RGB::FromHex("#FF0000"),
|
||||
},
|
||||
.BrushBorder = StrokeStyle {
|
||||
.Width = 7.0,
|
||||
.Colour = RGB::FromHex("#666666"),
|
||||
},
|
||||
.LengthToTimeScaling = [] (double length) -> double {
|
||||
return std::pow(length, 1.0 / 3.0) / 6.0;
|
||||
},
|
||||
.WaitBeforeRepeating = 1s,
|
||||
.DelayBetweenStrokes = 50ms,
|
||||
});
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue