Jump to content

How can i make a rainbow color function?


Recommended Posts

Hello,

you can use multiple whileloops

Spoiler
#include <Color.au3>

Local $RGB[] = [ 255, 0 , 0]
Local $SleepTime = 10

$hGUI = GUICreate("test", 100, 100)
GUISetBkColor(_ColorSetRGB($RGB), $hGUI)
GUISetState(@SW_SHOW)

For $i = 1 To 10
    While $RGB[1] < 255
        $RGB[1] += 1
        GUISetBkColor(_ColorSetRGB($RGB), $hGUI)
        Sleep($SleepTime)
    WEnd

    While $RGB[0] > 0
        $RGB[0] -= 1
        GUISetBkColor(_ColorSetRGB($RGB), $hGUI)
        Sleep($SleepTime)
    WEnd

    While $RGB[2] < 255
        $RGB[2] += 1
        GUISetBkColor(_ColorSetRGB($RGB), $hGUI)
        Sleep($SleepTime)
    WEnd

    While $RGB[1] > 0
        $RGB[1] -= 1
        GUISetBkColor(_ColorSetRGB($RGB), $hGUI)
        Sleep($SleepTime)
    WEnd

    While $RGB[0] < 255
        $RGB[0] += 1
        GUISetBkColor(_ColorSetRGB($RGB), $hGUI)
        Sleep($SleepTime)
    WEnd

    While $RGB[2] > 0
        $RGB[2] -= 1
        GUISetBkColor(_ColorSetRGB($RGB), $hGUI)
        Sleep($SleepTime)
    WEnd
Next

 

 

Edited by bernd670

greetings
bernd


I hacked 127.0.0.1 -> pcfred6.gif

Link to comment
Share on other sites

Might also help using HSL color space:

 

Edited by UEZ

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

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

×
×
  • Create New...