Jump to content
Sign in to follow this  
Jex

Gradient Color Box thing

Recommended Posts

Jex

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

Share this post


Link to post
Share on other sites
gseller

Yep I see that if the curser changes it make the curser start jumping.. LOL Smooth gradient tho... <_<

Share this post


Link to post
Share on other sites
Jex
_Kurt

Very cool, really like the effect! Great example of color change.

Kurt


Awaiting Diablo III..

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.