Merge pull request #1 from bergmeister/improvment_endcolumn_andvariablecolumnheight

Improvement: finite column length and make column length variable
master
matriex 2018-01-02 12:10:17 +05:30 committed by GitHub
commit a8f454893d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 24 deletions

View File

@ -1,27 +1,25 @@
# cmatrix Effect # cmatrix Effect
The matrix effect on windows through windows power shell The matrix effect on Windows through `PowerShell`
![Mareix](https://github.com/matriex/cmatrix/blob/master/cmatrix.PNG "Matrix effect") ![Matrix](demo.gif "Matrix effect")
## How to ## How to
1) Open Windows Powershell with Admin Privillege 1) Open `Windows Powershell` (in some cases Admin privilege might be needed)
2) Download and save cmatrix.psm1 to desktop 2) Either download and save [cmatrix.psm1](https://raw.githubusercontent.com/matriex/cmatrix/master/cmatrix.psm1) or just clonethis repo using `git clone https://github.com/matriex/cmatrix`
3) Create a folder cmatrix on "C:\Windows\System32\WindowsPowerShell\v1.0\Modules\" 3) Import the module, set the timeout and enable it:
````powershell
Set-Executionpolicy remotesigned
Import-Module .\cmatrix
Set-ScreenSaverTimeout -Seconds 5
Enable-ScreenSaver
````
4) Copy cmatrix.psm1 to "C:\Windows\System32\WindowsPowerShell\v1.0\Modules\cmatrix\cmatrix.psm1" If you are happy with it, then you can put it also in one of your module folders that you can get via `$env:PSModulePath`. Just create a folder named `cmatrix` and put `cmatrix.psm1` in it and then the next time you can just import it as `Import-Module cmatrix` without having to specify the full path.
5) Type the commands on terminal
**set-executionpolicy remotesigned**
**import-module cmatrix**
**Set-screenSaverTimeout -Seconds 5**
**Enable-ScreenSaver**
_Author: Oisin Grehan_ _Author: Oisin Grehan_
_Contributor: Christoph Bergmeister_

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

View File

@ -197,7 +197,8 @@ function New-Column {
[int]$script:head = 1 [int]$script:head = 1
[int]$script:fade = 0 [int]$script:fade = 0
[int]$script:fadelen = [math]::Abs($ylimit / 3) $randomLengthVariation = (1 + (get-random -min -30 -max 50)/100)
[int]$script:fadelen = [math]::Abs($ylimit / 3 * $randomLengthVariation)
$script:fadelen += (get-random -min 0 -max $fadelen) $script:fadelen += (get-random -min 0 -max $fadelen)
@ -224,14 +225,30 @@ function New-Column {
& $parentModule New-BufferCell -Character ` & $parentModule New-BufferCell -Character `
([char](get-random -min 65 -max 122)) -Fore darkgreen) > $null ([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++ $script:fade++
} }
# are we done animating? # are we done animating?
if ($fade -lt $ylimit) { if ($fade -lt $ylimit) {
return $true 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 $false
} }
@ -243,9 +260,9 @@ function New-Column {
function Start-ScreenSaver { function Start-ScreenSaver {
# feel free to tweak maxcolumns and frame delay # 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 { function Register-Timer {

BIN
demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 KiB