Add show-credits.ps1

This commit is contained in:
Markus Fleschutz
2021-04-22 08:56:07 +02:00
parent 1a9fdfb337
commit d9ab4a2fbc
4 changed files with 37 additions and 1 deletions

View File

@ -7,6 +7,8 @@
param($Line1 = "", $Line2 = "", $Line3 = "", $Line4 = "", $Line5 = "", $Line6 = "", $Line7 = "", $Line8 = "", $Line9 = "", [int]$Speed = 50) # 50 ms pause
$TerminalWidth = 120 # characters
function WriteAnimatedLine { param([string]$Line, [int]$Speed)
[int]$Start = 1
[int]$End = $Line.Length
@ -15,7 +17,7 @@ function WriteAnimatedLine { param([string]$Line, [int]$Speed)
if ($Line -ne "") {
foreach ($Pos in $Start .. $End) {
$TextToDisplay = $Spaces.Substring(0, 40 - $pos / 2) + $Line.Substring(0, $Pos)
$TextToDisplay = $Spaces.Substring(0, $TerminalWidth / 2 - $pos / 2) + $Line.Substring(0, $Pos)
write-host -nonewline $TextToDisplay
start-sleep -milliseconds $Speed
$HOST.UI.RawUI.CursorPosition = $StartPosition