Jump to content

Matrix style background effect ( Screensaver )


Jex
 Share

Recommended Posts

I'm bored and created that script :

$Screensaver = 1 ( Fullscreen and exit if mousemove )

$Screensaver = 0 ( 500x500 window size )

#include <Color.au3>
#include <GUIConstants.au3>
Global $Colors[51], $Color, $First = 1, $Oldtext, $Number[4], $Title

$Screensaver = 1
Opt("GUIOnEventMode", 1)
If $Screensaver = 1 Then
    $Width = @DesktopWidth
    $Height = @DesktopHeight
    $Form = GUICreate("Screensaver", $Width, $Height, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetOnEvent($GUI_EVENT_MOUSEMOVE, "Quit")
Else
    $Width = 500
    $Height = 500
    $Form = GUICreate("", $Width, $Height)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
EndIf
Global $Letter[$Width + 1]
GUISetBkColor(0x000000)
GUISetState()
For $i = 1 To 255 Step 2
    WinSetTrans($Form, "", $i)
Next
$Colors = Colors()
$Color = StringSplit($Colors, ",", 1)
$Letters = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9"
$Let = StringSplit($Letters, ",", 1)
$Title = WinGetTitle("")
If $Screensaver <> 1 Then Matrixtitle()
GuiColor("0x000000", "0x11672E", 30)
GuiColor("0x11672E", "0x000000", 30)

While 1
    Matrix()
WEnd

Func Matrixtitle()
    $Title = "Matrix"
    $Len = StringLen($Title)
    For $i = 1 To $Len
        $Left = StringLeft($Title, $i)
        If $i <> 1 Then $Left = StringTrimLeft($Left, $i - 1)
        For $z = 1 To 20
            $Text = $Oldtext & $Let[Random(1, 62, 1)]
            WinSetTitle("", "", $Text)
            Sleep(25)
        Next
        WinSetTitle("", "", $Oldtext & $Left)
        $Oldtext &= $Left
    Next
EndFunc   ;==>Matrixtitle

Func Matrix()
    For $i = 1 To $Width
        If $First = 0 Then
            If $i = $Width Then
                GUICtrlDelete($Letter[1])
            Else
                GUICtrlDelete($Letter[$i + 1])
            EndIf
            For $z = 1 To 3
                $Number[$z] = $i + ($z * ($Width / 4))
                If $Number[$z] > $Width Then $Number[$z] -= $Width
                $Pos = ControlGetPos($Title, "", $Letter[$Number[$z]])
                GUICtrlSetPos($Letter[$Number[$z]], $Pos[0], $Pos[1] + Random(5, 10, 1))
            Next
        EndIf
        $Letter[$i] = GUICtrlCreateLabel($Let[Random(1, 62, 1)], Random(1, $Width, 1), Random(1, $Height, 1), 15, 15)
        GUICtrlSetColor(-1, $Color[Random(1, 50, 1)])
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Next
    $First = 0
EndFunc   ;==>Matrix

Func Colors($nStartColor = 0x00FF00, $nEndColor = 0x000000)
    Local $color1R = _ColorGetRed($nStartColor)
    Local $color1G = _ColorGetGreen($nStartColor)
    Local $color1B = _ColorGetBlue($nStartColor)
    Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / 75
    Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / 75
    Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / 75
    For $i = 1 To 50
        $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R + $nStepR * $i, $color1G + $nStepG * $i, $color1B + $nStepB * $i)
        If $i = 1 Then
            $Colors = $sColor
        Else
            $Colors &= "," & $sColor
        EndIf
    Next
    Return $Colors
EndFunc   ;==>Colors

Func GuiColor($Color1 = 0x000000, $Color2 = 0x00FF00, $Step = 50, $Delay = 15)
    Local $ColorR = _ColorGetRed($Color1)
    Local $ColorG = _ColorGetGreen($Color1)
    Local $ColorB = _ColorGetBlue($Color1)
    Local $StepR = (_ColorGetRed($Color2) - $ColorR) / $Step
    Local $StepG = (_ColorGetGreen($Color2) - $ColorG) / $Step
    Local $StepB = (_ColorGetBlue($Color2) - $ColorB) / $Step
    For $i = 0 To $Step
        $sColor = "0x" & StringFormat("%02X%02X%02X", $ColorR + $StepR * $i, $ColorG + $StepG * $i, $ColorB + $StepB * $i)
        GUISetBkColor($sColor)
        Sleep($Delay)
    Next
EndFunc   ;==>Colors

Func Quit()
    For $i = 1 To $Width
        GUICtrlDelete($Letter[$i])
    Next
    GuiColor("0x000000", "0x11672E", 30)
    For $i = 255 To 1 Step -2
        WinSetTrans($Form, "", $i)
    Next
    Exit
EndFunc   ;==>Quit
Edited by Jex
Link to comment
Share on other sites

  • Replies 48
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Totally way cool effect, the only drawback is it is a resource hog. LOL My quad processor 3 gig machine toggles around 17 - 23% Processor usage.. wondering if the reduce memory function I have seen in some other scripts might reduce it.. Still a way cool effect..

Link to comment
Share on other sites

I'm changed some parts of script and now if you change $Width and $Height, automaticly changing other variables. ( I mean Letters count, etc. )

$Width = @DesktopWidth + 3

$Height = @DesktopHeight

Example try like that for see fullscreen.

Edit : I'm added $Screensaver variable.

Edited by Jex
Link to comment
Share on other sites

is there a way to make this faster.

If you remove that part :

For $z = 1 To 2
                $Number[$z] = $i + ($z * ($Width / 3))
                If $Number[$z] > $Width Then $Number[$z] -= $Width
                $Pos = ControlGetPos($Title, "", $Letter[$Number[$z]])
                GUICtrlSetPos($Letter[$Number[$z]], $Pos[0], $Pos[1] + 5)
            Next

Letters not move down and script run more fast.

Link to comment
Share on other sites

Your code for fullscreen doesn't work as it should, i can still see the bottom part of the title

edit: And there are some graphical glitches i cant explain...... weird, maybe my graphicsdrivers are not behaving as they should

Edited by TzarAlkex
Link to comment
Share on other sites

Can you send ss ? Because i can't understand what is your problem. Popup window havent title?

My computer seems to be having a nervous breakdown right now so no screenshots are possible.... I will try again after I have restarted my comp
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...