Skip to content

Commit

Permalink
Add option for how long to stay on the last frame of the animation
Browse files Browse the repository at this point in the history
  • Loading branch information
joelpurra committed Jan 23, 2015
1 parent a9348c5 commit b8194d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -48,14 +48,15 @@ Create repeatable, editable, automatable example usage of:
Running the software creates a series of `.png` images, and an `output.gif`.

```bash
cat "my-keys.txt" | keystroke-animator [--no-shadow] [countdown [keysleep [linesleep]]]
cat "my-keys.txt" | keystroke-animator [--no-shadow] [countdown [keysleep [linesleep [endsleep]]]]
```
- `my-keys.txt` Sequence of keys/characters to read from `stdin` and then "type", one by one.
- `--no-shadow` Turn off application window shadows (optional). Useful if the background of the window isn't white.
- `countdown` Pre-script countdown, in integer seconds (optional).
- `keysleep` Time to sleep between keys, in seconds (optional).
- `linesleep` Time to sleep between lines, in seconds (optional).
- `endsleep` Time to sleep at the end of the animation, in seconds (optional).
Expand Down
8 changes: 6 additions & 2 deletions src/keystroke-animator
Expand Up @@ -116,6 +116,8 @@ function typeKeysFromStdin {
shift
local -r lineSleep="${1:-1.0}"
shift
local -r endSleep="${1:-5.0}"
shift

local screenshotList="screenshot-filelist.txt"
local -i screenshotIndex=0
Expand Down Expand Up @@ -148,7 +150,7 @@ function typeKeysFromStdin {
done

# Screenshot final state, and hold for a while.
screenshot $(( screenshotIndex++ )) $(echo "5 * ${lineSleep}" | bc) >>"$screenshotList"
screenshot $(( screenshotIndex++ )) "$endSleep" >>"$screenshotList"

cat "$screenshotList" | tr '\n' '\0' | animator
}
Expand All @@ -166,6 +168,8 @@ function keystroker {
shift || true
local -r lineSleep="${1:-1.0}"
shift || true
local -r endSleep="${1:-5.0}"
shift || true

echo "keystroker: Now focus the window you want the typing to go in!"
for i in $(seq "$(( countdown - 1 ))" 0);
Expand All @@ -175,7 +179,7 @@ function keystroker {
done

echo "keystroker: Keystrokes are echoed in this window:"
typeKeysFromStdin "$keySleep" "$lineSleep"
typeKeysFromStdin "$keySleep" "$lineSleep" "$endSleep"
echo "keystroker: End of input."
}

Expand Down

0 comments on commit b8194d1

Please sign in to comment.