vhs icon indicating copy to clipboard operation
vhs copied to clipboard

feat: Add `TypeVariable` Command for Variable Typing Speed

Open prithvijj opened this issue 11 months ago • 2 comments

Changes

  • Adding in the TypeVariable command which types out the given letters in the string, in a variable typing speed,
  • The typing speed is determined by setting the TypingSpeedVariable option, and providing a min and max typing speed range
  • After every keystroke, it would wait randomly within the min and max typing speed range, such that it feels more human,

Testing Notes

Created prits.tape

Output prits.gif

Require echo

Set Shell "bash"
Set FontSize 32
Set Width 1200
Set Height 600
Set TypingSpeedVariable 50ms 555ms

Type "echo 'Welcome to VHS!'" Sleep 500ms  Enter
TypeVariable "echo 'Welcome to VHS!'" Sleep 500ms Enter

Ran go run . prits.tape which produced prits.gif

image

prits.gif showing the second echo command, has multiple pauses after each keystroke, feeling less robotic

prits

Other Notes

  • Related to https://github.com/charmbracelet/vhs/issues/574

  • I considered using another TypeVariable command instead of integrating it within Type itself. I guess it's easier to keep things separate, instead of multiple options affecting the same Type command,

  • [ ] Not sure how the TypeVariable@ would work, would be good to get some direction. Does [email protected] 2s "blah blah" be okay

  • [ ] I think I'm doing something wrong around parseTypeVariable, in the sense of not parsing the @1s for indicating speed (i.e. overrides of the speed), Would be cool to get some help/direction on that

  • [ ] Is there anything else I'm missing?

prithvijj avatar Feb 05 '25 13:02 prithvijj