garbb Posted March 1, 2022 Share Posted March 1, 2022 An easter egg type thing I made for a program that is based on other snow animation scripts I found on these forums that I thought I would share here in case anyone found it interesting. It is just moving around a bunch of label controls on top of everything else without interfering with usage of other controls. expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> Global $runTimer = TimerInit() Const $GUIWIDTH = 500, $GUIHEIGHT = 200 $hGui = GUICreate("TEST", $GUIWIDTH, $GUIHEIGHT, -1, -1, -1, BitOR($WS_EX_LAYERED, $WS_EX_COMPOSITED)) $aSnow = snowInit() $hbut = GUICtrlCreateButton('test', 100,20,50,30) GUICtrlCreateEdit('test', 100,100,200,50) GUICtrlCreateGroup("Group 1", 350, 40, 90, 140) GUICtrlCreateRadio("Radio 1", 370, 80, 60, 15) GUICtrlCreateRadio("Radio 2", 370, 120, 60, 15) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUISetState(@SW_SHOW, $hGui) AdlibRegister(snowAnimate, 40) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hbut ConsoleWrite('button' & @CRLF) EndSwitch WEnd Func snowInit() Local Const $isnowflakes = 50 ; number of snowflakes Local $aSnow[$isnowflakes][5] ; 0=length/width, 1=left (x pos), 2=top (y pos), 3=handle, 4=fall speed ; create snowflakes For $i = 0 To UBound($aSnow) - 1 $aSnow[$i][3] = GUICtrlCreateLabel("*", 0, 0, 0, 0) GUICtrlSetState(-1, $GUI_DISABLE + $GUI_HIDE) ; $GUI_DISABLE allows click thru snow but changes to grey color, $GUI_HIDE so we can show it later GUICtrlSetStyle(-1, 0) ; removes grey color but still disabled, and prevent double-clicking copying text to clipboard GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ; for transparent label control over non-transparent window GUICtrlSetColor(-1, 0) ; snow color Next Return $aSnow EndFunc Func snowAnimate() Local Const $iMinR = 5 ; minimum length of the snowflake's side Local Const $iMaxR = 15; max length Local Const $creation_interval = 500 ; spawn new snowflake every X ms Local Static $lastCreationTime = 0 Local $now = TimerDiff($runTimer) For $i = 0 To UBound($aSnow) - 1 ; if this snowflake not visible yet If BitAND(GUICtrlGetState($aSnow[$i][3]), $GUI_HIDE) And ($now - $lastCreationTime > $creation_interval) Then snowRandomize($aSnow, $i, $iMinR, $iMaxR) GUICtrlSetState($aSnow[$i][3], $GUI_SHOW) $lastCreationTime = $now Else $aSnow[$i][2] += $aSnow[$i][4] ; increment y pos If Random(1,20,1) = 20 Then $aSnow[$i][1] += Random(-2, 2, 0) ; x randomness GUICtrlSetPos($aSnow[$i][3], $aSnow[$i][1], $aSnow[$i][2]) ; when it gets to bottom of screen, change to random size and x pos and move to top of screen again If $aSnow[$i][2] > $GUIHEIGHT Then snowRandomize($aSnow, $i, $iMinR, $iMaxR) EndIf EndIf Next EndFunc Func snowRandomize(ByRef $aSnow, $i, $iMinR, $iMaxR) $aSnow[$i][0] = Random($iMinR, $iMaxR, 0) ; dimension of snow $aSnow[$i][1] = Random(0 - $iMaxR, $GUIWIDTH + $iMaxR, 0) ; x position $aSnow[$i][2] = 0 - $iMaxR ; y position (out of screen at startup) $aSnow[$i][4] = Random(0.05, 2) GUICtrlSetPos($aSnow[$i][3], $aSnow[$i][1], $aSnow[$i][2], $aSnow[$i][0], $aSnow[$i][0]) GUICtrlSetFont($aSnow[$i][3] , Floor(0.25 + $aSnow[$i][0]*1.25), 800, 0, '', 4) EndFunc ;==>_Randomize junkew, Dan_555 and UEZ 3 Link to comment Share on other sites More sharing options...
UEZ Posted March 1, 2022 Share Posted March 1, 2022 Funny idea! Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
HurleyShanabarger Posted March 1, 2022 Share Posted March 1, 2022 The funniest thing about that is, that I had no idea a doube blick on a label would copy the label text to the clipboard 😃 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now