Skip to content

Commit

Permalink
Add loopcount to image renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaunLawrie authored Dec 7, 2023
1 parent 6205814 commit 604dd5d
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Get-SpectreImageExperimental {
param (
[string] $ImagePath,
[int] $MaxWidth,
[switch] $Repeat,
[int] $LoopCount = 0,
[ValidateSet("Bicubic", "NearestNeighbor")]
[string] $Resampler = "Bicubic"
)
Expand Down Expand Up @@ -134,14 +134,20 @@ function Get-SpectreImageExperimental {
}
}

0..$scaledHeight | Foreach-Object {
Write-host
}
$topLeft = $Host.UI.RawUI.CursorPosition
$topLeft.Y = $topLeft.Y - $scaledHeight
$loopIterations = 0
[Console]::CursorVisible = $false
do {
foreach($frame in $frames) {
[Console]::SetCursorPosition($topLeft.X, $topLeft.Y)
Write-Host $frame.Frame
Start-Sleep -Milliseconds $frame.FrameDelayMilliseconds
}
} while ($Repeat)
$loopIterations++
} while ($loopIterations -lt $LoopCount)
[Console]::CursorVisible = $true
}

0 comments on commit 604dd5d

Please sign in to comment.