Jump to content

Gradient Color Box thing


Jex
 Share

Recommended Posts

I'm bored and created that useless thing but good example for gradient color change in my opinion. ( If cursor pointer change, box vibrating )

My objective is creating box cursor but i cant hide cursor and if im hide click functions not work.

#include <Color.au3>
#include <GUIConstants.au3>
Global $Width = 50, $Height = 50
HotKeySet("{ESC}", "_Exit")
GUICreate("Test", $Width, $Height, -1, -1, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST)
WinSetTrans("Test", "", 175)
GUISetState()

Func Colors($Color1 = "0xFF0000", $Color2 = "0xFFFF00", $Step = 50, $Delay = 15, $Vib = 1)
    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)
        $Pos = MouseGetPos()
        If $Vib = 1 And MouseGetCursor() <> 2 Then
            WinMove("Test", "", ($Pos[0] - $Width) - Random(2, 5, 1), ($Pos[1] - $Height) - Random(2, 5, 1))
        Else
            WinMove("Test", "", ($Pos[0] - $Width) - 2, ($Pos[1] - $Height) - 2)
        EndIf
    Next
EndFunc   ;==>Colors

While 1
    Colors("0xFF0000", "0x00FF00")
    Colors("0x00FF00", "0x0000FF")
    Colors("0x0000FF", "0xFF0000")
WEnd

Func _Exit()
    Exit
EndFunc   ;==>_Exit
Edited by Jex
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...