Private/Start-AssessmentCountdown.ps1

# Start-AssessmentCountdown.ps1
# Displays a countdown timer before the assessment begins.
# Part of the M365-QuickAssess module -- not exported.

function Start-AssessmentCountdown
{
    param
    (
        [int]$Seconds = 10,
        [string]$Message = "Assessment will begin in"
    )

    for ( $i = $Seconds; $i -ge 1; $i-- )
    {
        $dots = "." * ( ( $Seconds - $i ) % 3 + 1 )
        $text = " $Message $i$dots"

        Write-Host "`r$text" -NoNewline -ForegroundColor Cyan
        Start-Sleep -Seconds 1
    }

    Write-Host "`r $Message 0... Starting now. " -ForegroundColor Green
    Write-Host ""
}