Info Posted April 26, 2008 Posted April 26, 2008 (edited) I want to make a continuously from the red color (0xFF0000) to the far blue color (0x0000FF) wich will appear in the backround color in my GUI...Thanks for the helpers Edited April 26, 2008 by Info
monoceres Posted April 26, 2008 Posted April 26, 2008 Maybe this? Dim $color=0xFF0000 Dim $blue=0 For $red=255 To 0 Step -1 $color="0x"&Hex($red,2)&"00"&Hex($blue,2) $blue+=1 Next Broken link? PM me and I'll send you the file!
PsaltyDS Posted April 26, 2008 Posted April 26, 2008 I want to make a continuously from the red color (0xFF0000) to the far blue color (0x0000FF) wich will appear in the backround color in my GUI... Thanks for the helpers Use the for next loop to get an index value: For $i = 0 To 0xFF ; Do stuff Next During the loop you can add the index to 0 to get increasing values for one, and subtract the same index from 0xFF to get decreasing values for the other: $iRed = 0 + $i $iBlue = 0xFF - $i $iColor = (0x010000 * $iRed) + $iBlue Going back the other way just means switching the values: $iRed = 0xFF - $i $iBlue = 0 + $i $iColor = (0x010000 * $iRed) + $iBlue I did a demo a ways back that continuously varies the BKColor of a progress bar by changing all three primary colors with only slightly more math, but I don't have a link handy at the moment. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Info Posted April 26, 2008 Author Posted April 26, 2008 Guys I understand nothing in the codes you gave me... Can someone please explain me what are those codes?
Valuater Posted April 26, 2008 Posted April 26, 2008 (edited) Func XSkinGradient($nXSkinGUI, $nStartColor, $nEndColor) Local $nSize = WinGetClientSize($nXSkinGUI) Local $nX=0, $nY=0, $nWidth=$nSize[0], $nHeight=$nSize[1] Local $color1R = _ColorGetRed($nStartColor) Local $color1G = _ColorGetGreen($nStartColor) Local $color1B = _ColorGetBlue($nStartColor) Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $nHeight Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $nHeight Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $nHeight $nGraph = GuiCtrlCreateGraphic($nX, $nY, $nWidth, $nHeight) For $i = 0 To $nHeight - $nY $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $sColor, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i) GUICtrlSetGraphic(-1, $GUI_GR_LINE, $nWidth, $i) Next GUICtrlSetState( $nGraph, $GUI_DISABLE) Return $nGraph EndFuncBe sure to #include <Color.au3>.... more herehttp://www.autoitscript.com/forum/index.ph...st&p=2956138) Edited April 26, 2008 by Valuater
ProgAndy Posted April 26, 2008 Posted April 26, 2008 (edited) I made a Gradient Function some time ago: expandcollapse popup;=============================================================================== ; ; Function Name: _Gradient($RGB_Color1 ,$RGB_Color2, $Count) ; Description:: Returns an Array of Gradient Colors ; Parameter(s): $RGB_Color1 : The Start-Color in RGB Hexadecimal ; $RGB_Color2 : The End-Color in RGB Hexadecimal ; $Count : The number of Colors in the Gradient ; Requirement(s): ; Return Value(s): An Array with the Colors ; Author(s): Prog@ndy ; ;=============================================================================== ; Func _Gradient($RGB_Color1 ,$RGB_Color2, $Count) Local $Color1_R, $Color1_G, $Color1_B, $Color2_R, $Color2_G, $Color2_B, $NeuCol_R, $NeuCol_G, $NeuCol_B $Color1_R = BitAND( BitShift($RGB_Color1, 16), 0xff) $Color1_G = BitAND( BitShift($RGB_Color1, 8), 0xff) $Color1_B = BitAND($RGB_Color1, 0xff) $Color2_R = BitAND( BitShift($RGB_Color2, 16), 0xff) $Color2_G = BitAND( BitShift($RGB_Color2, 8), 0xff) $Color2_B = BitAND($RGB_Color2, 0xff) $Count -= 1 ; 0-basiert ! Dim $arColors[$Count+1], $pos1 For $i = 0 To $Count $pos1 = $Count - $i $NeuCol_R = ($Color1_R * $pos1 + $Color2_R * $i) / ($Count) $NeuCol_G = ($Color1_G * $pos1 + $Color2_G * $i) / ($Count) $NeuCol_B = ($Color1_B * $pos1 + $Color2_B * $i) / ($Count) $arColors[$i] = Execute("0x" & Hex($NeuCol_R,2) & Hex($NeuCol_G,2) & Hex($NeuCol_B,2)) Next Return $arColors EndFunc In each step, the Value of each color-component is combined from the decrementing value of the source-color and the incrementing amount of the destination-color. In the end, we have all color components from Color 2 Edited April 26, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Info Posted April 26, 2008 Author Posted April 26, 2008 (edited) @Valuater, You just gave me a code without explaining anyting... @ProgAndy, THANKS! Edited April 26, 2008 by Info
Valuater Posted April 26, 2008 Posted April 26, 2008 @Valuater, You just gave me a code without explaining anyting.......WOWdo you see thisXSkinGradient($nXSkinGUI, $nStartColor, $nEndColor)did you even bother to click the link to the demo and pictures and example ?????????????????????????? ??????????????????????8)
monoceres Posted April 26, 2008 Posted April 26, 2008 I played a little and found this to be quite interesting: #include <GUIConstantsEx.au3> Opt("GuiOnEventMode", 1) GUICreate("test") GUISetState() GUISetOnEvent(-3, "close") Dim $color, $redm=1, $bluem=2, $greenm=3, $index While 1 Sleep(10) $index+=0.01 $color="0x"&Hex(255*((Sin($index*$redm)+1)/2),2)& Hex(255*((Sin($index*$greenm)+1)/2),2)&Hex(255*((Sin($index*$bluem)+1)/2),2) GUISetBkColor($color) WEnd Func close() Exit EndFunc ;==>close Broken link? PM me and I'll send you the file!
Valuater Posted April 26, 2008 Posted April 26, 2008 I played a little and found this to be quite interesting: expandcollapse popup#include <GUIConstantsEx.au3> Opt("GuiOnEventMode", 1) GUICreate("test") GUISetState() GUISetOnEvent(-3, "close") Dim $color, $redm=1, $bluem=2, $greenm=3, $index While 1 Sleep(10) $index+=0.01 $color="0x"&Hex(255*((Sin($index*$redm)+1)/2),2)& Hex(255*((Sin($index*$greenm)+1)/2),2)&Hex(255*((Sin($index*$bluem)+1)/2),2) GUISetBkColor($color) WEnd Func close() Exit EndFunc ;==>closeoÝ÷ Ûú®¢×¢ÐZw}÷ß}Üæ§yغ§u8Ê "h¦Vz+b¢+Vªiz»ºÚ"µÍÚ[ÛYH ÑÕRPÛÛÝ[Ñ^]LÉÝÂ[H ÌÍØÛÛÜ ÌÍÜYHHK ÌÍØY[HH ÌÍÙÜY[HHË ÌÍÚ[^ÕRPÜX]J ][ÝÝÝ ][ÝÊBÕRTÙ]Ý]J BÚ[HÕRQÙ]ÙÊ H ÉÝÈLÂÛY L B ÌÍÚ[^ ÏHB ÌÍØÛÛÜH ][ÝÌ ][ÝÈ [È^ MH Ú[ ÌÍÚ[^ ÌÍÜYJH ÈJHÈKH [È^ MH Ú[ ÌÍÚ[^ ÌÍÙÜY[JH ÈJHÈKH [È^ MH Ú[ ÌÍÚ[^ ÌÍØY[JH ÈJHÈKBÕRTÙ]ÐÛÛÜ ÌÍØÛÛÜBÑ[ 8)
Info Posted April 26, 2008 Author Posted April 26, 2008 (edited) I played a little and found this to be quite interesting: #include <GUIConstantsEx.au3> Opt("GuiOnEventMode", 1) GUICreate("test") GUISetState() GUISetOnEvent(-3, "close") Dim $color, $redm=1, $bluem=2, $greenm=3, $index While 1 Sleep(10) $index+=0.01 $color="0x"&Hex(255*((Sin($index*$redm)+1)/2),2)& Hex(255*((Sin($index*$greenm)+1)/2),2)&Hex(255*((Sin($index*$bluem)+1)/2),2) GUISetBkColor($color) WEnd Func close() Exit EndFunc ;==>closeThanks Helped me a lot Edit: Is there a way to convert it to a .gif image? Edited April 26, 2008 by Info
ProgAndy Posted April 26, 2008 Posted April 26, 2008 (edited) record it Example: Edited April 26, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Valuater Posted April 26, 2008 Posted April 26, 2008 Original Post:Asking for continuously from the red to blue (Gradient)I want to make a continuously from the red color (0xFF0000) to the far blue color (0x0000FF) wich will appear in the backround color in my GUI...Midway Post:Accepting the "changing color" GUI (Not Gradient)Thanks Helped me a lot Last Post/EditWanting it to be a "Picture"Edit:Is there a way to convert it to a .gif image?????8)
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