mirror of
https://github.com/JakeWharton/mosaic.git
synced 2025-10-26 19:44:33 +08:00
Use agg to render gifs
This commit is contained in:
committed by
Jake Wharton
parent
e33bec7302
commit
73a62c7129
@ -3,9 +3,7 @@
|
|||||||
An experimental tool for building console UI in Kotlin using the Jetpack Compose compiler/runtime.
|
An experimental tool for building console UI in Kotlin using the Jetpack Compose compiler/runtime.
|
||||||
Inspired by [Ink](https://github.com/vadimdemedes/ink).
|
Inspired by [Ink](https://github.com/vadimdemedes/ink).
|
||||||
|
|
||||||
<img src="samples/jest/demo.svg">
|
<img src="samples/jest/demo.gif">
|
||||||
|
|
||||||
(Heads up: this SVG has a slight [rendering bug](https://github.com/JakeWharton/mosaic/issues/6))
|
|
||||||
|
|
||||||
Jump to:
|
Jump to:
|
||||||
[Introduction](#Introduction) |
|
[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.)
|
(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
|
## Usage
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
# Example: counter
|
# Example: counter
|
||||||
|
|
||||||
<img src="demo.svg">
|
<img src="demo.gif">
|
||||||
|
|||||||
BIN
samples/counter/demo.gif
Normal file
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 |
@ -1,3 +1,3 @@
|
|||||||
# Example: jest
|
# Example: jest
|
||||||
|
|
||||||
<img src="demo.svg">
|
<img src="demo.gif">
|
||||||
|
|||||||
BIN
samples/jest/demo.gif
Normal file
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 |
@ -1,3 +1,3 @@
|
|||||||
# Example: robot
|
# Example: robot
|
||||||
|
|
||||||
<img src="demo.svg">
|
<img src="demo.gif">
|
||||||
|
|||||||
BIN
samples/robot/demo.gif
Normal file
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 |
@ -1,7 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if ! command -v svg-term &> /dev/null; then
|
if ! command -v asciinema &> /dev/null; then
|
||||||
echo "Command 'svg-term' not found. Please install with 'npm install -g svg-term-cli'."
|
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
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -25,11 +29,14 @@ for sample in $REPO_DIR/samples/*; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running $command..."
|
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
|
cat > "$sample/README.md" <<EOL
|
||||||
# Example: $sample_name
|
# Example: $sample_name
|
||||||
|
|
||||||
<img src="demo.svg">
|
<img src="demo.gif">
|
||||||
EOL
|
EOL
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user