From e4ec99cfcddde8c68b0c9295b1997431787a51a6 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 18 Dec 2017 23:38:35 +0000 Subject: [PATCH] remove tail end --- cmatrix.psm1 | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/cmatrix.psm1 b/cmatrix.psm1 index ade1cac..3fed9c1 100644 --- a/cmatrix.psm1 +++ b/cmatrix.psm1 @@ -216,21 +216,37 @@ function New-Column { $script:head++ } - - # time to start rendering the darker green "tail?" + + # time to start rendering the darker green "tail?" if ($head -gt $fadelen) { - + & $parentModule Set-BufferCell $xpos $fade ( & $parentModule New-BufferCell -Character ` ([char](get-random -min 65 -max 122)) -Fore darkgreen) > $null - + + # tail end + $tail = $fade-1 + if ($tail -lt $ylimit) { + & $parentModule Set-BufferCell $xpos ($fade-1) ( + & $parentModule New-BufferCell -Character ` + ([char](get-random -min 65 -max 122)) -Fore black) > $null + } + $script:fade++ } - + + # are we done animating? if ($fade -lt $ylimit) { return $true } + + # remove last row from tail end + if (($fade - 1) -lt $ylimit) { + & $parentModule Set-BufferCell $xpos ($fade - 1) ( + & $parentModule New-BufferCell -Character ` + ([char]' ') -Fore black) > $null + } $false } @@ -243,9 +259,9 @@ function New-Column { function Start-ScreenSaver { # feel free to tweak maxcolumns and frame delay - # currently 8 columns with 50ms wait + # currently 20 columns with 30ms wait - Start-CMatrix -max 8 -frame 50 + Start-CMatrix -max 20 -frame 30 } function Register-Timer {