Use agg to render gifs

This commit is contained in:
Jake Wharton
2023-01-17 23:52:59 -05:00
committed by Jake Wharton
parent e33bec7302
commit 73a62c7129
11 changed files with 16 additions and 14 deletions

View File

@ -3,9 +3,7 @@
An experimental tool for building console UI in Kotlin using the Jetpack Compose compiler/runtime.
Inspired by [Ink](https://github.com/vadimdemedes/ink).
<img src="samples/jest/demo.svg">
(Heads up: this SVG has a slight [rendering bug](https://github.com/JakeWharton/mosaic/issues/6))
<img src="samples/jest/demo.gif">
Jump to:
[Introduction](#Introduction) |
@ -76,7 +74,7 @@ fun main() = runMosaic {
(Note: You may need to add imports for `androidx.compose.runtime.getValue` and `import androidx.compose.runtime.setValue` manually.)
<img src="samples/counter/demo.svg">
<img src="samples/counter/demo.gif">
## Usage

View File

@ -1,3 +1,3 @@
# Example: counter
<img src="demo.svg">
<img src="demo.gif">

BIN
samples/counter/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -1,3 +1,3 @@
# Example: jest
<img src="demo.svg">
<img src="demo.gif">

BIN
samples/jest/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 31 KiB

View File

@ -1,3 +1,3 @@
# Example: robot
<img src="demo.svg">
<img src="demo.gif">

BIN
samples/robot/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 21 KiB

View File

@ -1,7 +1,11 @@
#!/usr/bin/env bash
if ! command -v svg-term &> /dev/null; then
echo "Command 'svg-term' not found. Please install with 'npm install -g svg-term-cli'."
if ! command -v asciinema &> /dev/null; then
echo "Command 'asciinema' not found. Please install and put on path."
exit
fi
if ! command -v agg &> /dev/null; then
echo "Command 'agg' not found. Please install and put on path."
exit
fi
@ -25,11 +29,14 @@ for sample in $REPO_DIR/samples/*; do
fi
echo "Running $command..."
svg-term "--command=$command" "--out=$sample/demo.svg" --from=50 --window --width=60 --height=16 --no-cursor
rm -f $sample/demo.cast
asciinema rec -c "$command" $sample/demo.cast
agg --cols 60 --rows 18 $sample/demo.cast $sample/demo.gif
rm $sample/demo.cast
cat > "$sample/README.md" <<EOL
# Example: $sample_name
<img src="demo.svg">
<img src="demo.gif">
EOL
fi
done