Jump to content

Recommended Posts

Posted (edited)

Here is an alternate progress bar ^^

You know K2000 ? You know the lights in front of the car ? i just love this effect, so i decided to re-produce it.

here is the current code :

any suggestion of improvements are welcome, because there is still some bugs <_<

NEW !

Combined of the two effects

be careful => cpu consumes

NEW ! The uDf by Kohr

[autoit]#cs $Size = Total labels to create. (enter text to display)

$SizeValueFade = Speed that the labels shrink. (0 = no shrink)

$ValueFade = Value to give the color a fade effect. Positive and Negative numbers work. (0 = no fade)

$ValueMaxColor = Base Hex color for Labels.

$Type = (0=angle bottom, 1=angle top/bottom, all other numbers=angle top)

$Limit = Total times to display. (left to right = 1, right to left = 1)

$Delay = The speed for the label effects. The larger the number the slower it goes.

$ItemWidth = The label width.

$ItemSpace = The amount of space between each label.

$FontSize = Font Size.

$FontWeight = Font Weight.

$FontName = Font Name.

#ce

Func _K2000($Size, $SizeValueFade, $ValueFade, $ValueMaxColor, $Type, $Limit, _

$Delay = 20, $ItemWidth = 20, $ItemSpace = 1, $FontSize = 14, $FontWeight = 800, $FontName = "Ariel")

Dim $tabsize, $istring = 0

$string = $Size

$Size = StringLen($Size)

$istring = 1

$tabsize = $Size - 1

$middle = Mod($Size, 2)

If $middle = 0 Then

$middle = $Size / 2

Else

$middle = $Size / 2 - 0.5

EndIf

Dim $light[$Size], $lightvalue[$Size], $currentheight[$Size], $currentwidth[$Size], $Sizevalue[$Size]

$widthtoset = $ItemWidth + $ItemSpace

$width = 10 + $Size * $widthtoset

$height = 25 + $Size

$setheight = $height - $Size - 5

$Form1 = GUICreate("AForm1", $width, $height, -1, -1, $WS_POPUP)

$totalsize = 20 + $Size

$widthset = 5

;#####################

;Labels before middle

;#####################

For $i = 0 To $middle - 1

$currentwidth[$i] = $widthset

$light[$i] = GUICtrlCreateLabel("", $widthset, $setheight - $i, $ItemWidth, $i + $Size)

GUICtrlSetBkColor(-1, $ValueMaxColor)

GUICtrlSetFont(-1, $FontSize, $FontWeight, 0, $FontName)

If $istring Then GUICtrlSetData(-1, StringMid($string, $i + 1, 1))

$widthset += $widthtoset

Next

;#####################

;Labels for middle

;#####################

$light[$middle] = GUICtrlCreateLabel("", $widthset, $setheight - $middle, $ItemWidth, $middle + $Size)

GUICtrlSetBkColor(-1, $ValueMaxColor)

GUICtrlSetFont(-1, $FontSize, $FontWeight, 0, $FontName)

If $istring Then GUICtrlSetData(-1, StringMid($string, $i + 1, 1))

$currentwidth[$middle] = $widthset

$widthset += $widthtoset

$k = 0

$itemheight = $setheight - $middle + 1

$itemsize = $middle + $Size - 1

;#####################

;Labels after middle

;#####################

For $i = $middle + 1 To $tabsize

$currentwidth[$i] = $widthset

$light[$i] = GUICtrlCreateLabel("", $widthset, $itemheight, $ItemWidth, $itemsize)

GUICtrlSetBkColor(-1, $ValueMaxColor)

GUICtrlSetFont(-1, $FontSize, $FontWeight, 0, $FontName)

If $istring Then GUICtrlSetData(-1, StringMid($string, $i + 1, 1))

$widthset += $widthtoset

$itemheight += 1

$itemsize -= 1

Next

GUISetState(@SW_SHOW)

GUISetBkColor(0x000000)

AdlibEnable("messageHandler", 50)

$countlimit = 0

While 1

If $countlimit = $Limit Then ExitLoop

$countlimit += 1

For $i = 0 To $tabsize

$lightvalue[$i] = $ValueMaxColor

$Sizevalue[$i] = $totalsize

GUICtrlSetBkColor($light[$i], $totalsize)

If $i <= $tabsize Then

For $current = $i + 1 To $tabsize

$Sizevalue[$current] -= $SizeValueFade

Switch $Type

Case 0

GUICtrlSetPos($light[$current], $currentwidth[$current], 0, $ItemWidth, $Sizevalue[$current])

Case 1

GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]) / 2, $ItemWidth, $Sizevalue[$current])

Case Else

GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]), $ItemWidth, $Sizevalue[$current])

EndSwitch

$lightvalue[$current] -= $ValueFade

GUICtrlSetBkColor($light[$current], $lightvalue[$current])

Next

EndIf

If $i > 0 Then

For $current = $i - 1 To 0 Step - 1

$Sizevalue[$current] -= $SizeValueFade

Switch $Type

Case 0

GUICtrlSetPos($light[$current], $currentwidth[$current], 0, $ItemWidth, $Sizevalue[$current])

Case 1

GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]) / 2, $ItemWidth, $Sizevalue[$current])

Case Else

GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]), $ItemWidth, $Sizevalue[$current])

EndSwitch

$lightvalue[$current] -= $ValueFade

GUICtrlSetBkColor($light[$current], $lightvalue[$current])

Next

EndIf

Sleep($Delay)

Next

If $countlimit = $Limit Then ExitLoop

$countlimit += 1

For $i = $tabsize To 0 Step - 1

$lightvalue[$i] = $ValueMaxColor

$Sizevalue[$i] = $totalsize

GUICtrlSetBkColor($light[$i], $totalsize)

If $i < $tabsize Then

For $current = $i + 1 To $tabsize

$Sizevalue[$current] -= $SizeValueFade

Switch $Type

Case 0

GUICtrlSetPos($light[$current], $currentwidth[$current], 0, $ItemWidth, $Sizevalue[$current])

Case 1

GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]) / 2, $ItemWidth, $Sizevalue[$current])

Case Else

GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]), $ItemWidth, $Sizevalue[$current])

EndSwitch

$lightvalue[$current] -= $ValueFade

GUICtrlSetBkColor($light[$current], $lightvalue[$current])

Next

EndIf

If $i > 0 Then

For $current = $i - 1 To 0 Step - 1

$Sizevalue[$current] -= $SizeValueFade

Switch $Type

Case 0

GUICtrlSetPos($light[$current], $currentwidth[$current], 0, $ItemWidth, $Sizevalue[$current])

Case 1

GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]) / 2, $ItemWidth, $Sizevalue[$current])

Case Else

GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]), $ItemWidth, $Sizevalue[$current])

EndSwitch

$lightvalue[$current] -= $ValueFade

GUICtrlSetBkColor($light[$current], $lightvalue[$current])

Next

EndIf

Sleep($Delay)

Next

WEnd

EndFunc ;==>_K2000

Edited by arcker

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Posted (edited)

Hi!

Nice Script!! Respect!

If you want you can replace the labels with graphics (GuiCtrlCreateGraphic) its then maybe quiet nicer ;-)

Mfg Spider

Edited by GtaSpider

www.AutoIt.de - Moderator of the German AutoIt Forum

 

Posted (edited)

heeeyy, thx for the feedback, didn't realize it would please you too ^^

i wonder if i can make gradient color, less "K2000 style", but smoother

i'm trying to make the fade effect more coool

I replaced...

_kitstart()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEndoÝ÷ Û­«­¢+Ù±¥¹± ÅÕ½ÐíµÍÍ!¹±ÈÅÕ½Ðì°ÔÀ¤()}­¥ÑÍÑÉÐ ¤)Õ¹µÍÍ!¹±È ¤(%%U%Ñ5Í ¤ôÀÌØíU%}Y9Q}
1=MQ¡¸á¥Ð)¹Õ¹

cause I don't think you msg handler was doing anything.

now ESC exits.

Lar.

yes thx for the suggestion,

hope i can convert this gui to an udf

Edited by arcker

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Posted

This is really nice. Good luck with the UDF - it should be really good.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Posted

ok, the effect is simply perfect now

i've simplified the array to make it comprehensible

fade can be choosed now

and $maxlight too

have fun

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Posted

heeeyy, thx for the feedback, didn't realize it would please you too ^^

i wonder if i can make gradient color, less "K2000 style", but smoother

i'm trying to make the fade effect more coool

yes thx for the suggestion,

hope i can convert this gui to an udf

Your "progress bar" really looks nice.

For better gradient effects look here - it's not my UDF but I like it.

Posted

Your "progress bar" really looks nice.

For better gradient effects look here - it's not my UDF but I like it.

thx for the link, i will try to finish the current script before to start with gradient ^^

now, again an update :

custom size => $size

BUT => a bug in the creation of the second part of the creation of the label, because when you change the size, they are decaled

and i really don't understand Why ! please someone give me the correction to make :P

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Posted

wow. just wow.

awsome...

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Posted

thx all ^^

here the news :

bugs with size modification fixed

new :

+ set the space between items

+ set the items width

look at the new code to see what i mean ^^

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Posted (edited)

thx all ^^

here the news :

bugs with size modification fixed

new :

+ set the space between items

+ set the items width

look at the new code to see what i mean ^^

I like first one more.

Idea: make configurable also:

- color (green would be nice)

- time delay

- maybe type (previous x current)

EDIT: now I looked to your new code and you have done color and delay.

Edited by Zedna
Posted

maybe type (previous x current)

what do you mean ?? :P

i hope it's not too hard ^^

new code posted : instead of fading colors, it's histogram

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Posted

Type of progressbar:

Standard/Histogram/...

yes, not bad idea

i think more of the sens of the datagram (vertical or horizontal)

and make style of the labels (centered, all same size, and more)

+ combined the two scripts to manage the size AND the color

but the cpu will not appreciate i think

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Posted

arcker I modified this some so I could understand the function parameters. I changed your udf from HERE and added some things like font controls. I am posting this to give you more ideas on this great function.

#include <GUIConstants.au3>
_K2000("K2000 by arcker", 1, 20, "0xff0000", 2, 2)
_K2000("K2000 by arcker", 1, 10, "0xff0000", 2, 2)
_K2000("K2000 by arcker", 1, -10, "0xff0000", 2, 2)
_K2000("K2000 by arcker", 1, -20, "0xff0000", 2, 2)

#cs
    $Size = Total labels to create. (enter text to display)
    $SizeValueFade = Speed that the labels shrink. (0 = no shrink)
    $ValueFade = Value to give the color a fade effect. Positive and Negative numbers work. (0 = no fade)
    $ValueMaxColor = Base Hex color for Labels.
    $Type = (0=angle bottom, 1=angle top/bottom, all other numbers=angle top)
    $Limit = Total times to display. (left to right = 1, right to left = 1)
    $Delay = The speed for the label effects. The larger the number the slower it goes.
    $ItemWidth = The label width.
    $ItemSpace = The amount of space between each label.
    $FontSize = Font Size.
    $FontWeight = Font Weight.
    $FontName = Font Name.
#ce
Func _K2000($Size, $SizeValueFade, $ValueFade, $ValueMaxColor, $Type, $Limit, _
        $Delay = 20, $ItemWidth = 20, $ItemSpace = 1, $FontSize = 14, $FontWeight = 800, $FontName = "Ariel")
    Dim $tabsize, $istring = 0
    $string = $Size
    $Size = StringLen($Size)
    $istring = 1
    $tabsize = $Size - 1
    $middle = Mod($Size, 2)
    If $middle = 0 Then
        $middle = $Size / 2
    Else
        $middle = $Size / 2 - 0.5
    EndIf

    Dim $light[$Size], $lightvalue[$Size], $currentheight[$Size], $currentwidth[$Size], $Sizevalue[$Size]
    $widthtoset = $ItemWidth + $ItemSpace
    $width = 10 + $Size * $widthtoset
    $height = 25 + $Size
    $setheight = $height - $Size - 5
    $Form1 = GUICreate("AForm1", $width, $height, -1, -1, $WS_POPUP)
    $totalsize = 20 + $Size
    
    $widthset = 5
    ;#####################
    ;Labels before middle
    ;#####################
    For $i = 0 To $middle - 1
        $currentwidth[$i] = $widthset
        $light[$i] = GUICtrlCreateLabel("", $widthset, $setheight - $i, $ItemWidth, $i + $Size)
        GUICtrlSetBkColor(-1, $ValueMaxColor)
        GUICtrlSetFont(-1, $FontSize, $FontWeight, 0, $FontName)
        If $istring Then GUICtrlSetData(-1, StringMid($string, $i + 1, 1))
        $widthset += $widthtoset
    Next
    ;#####################
    ;Labels for middle
    ;#####################
    $light[$middle] = GUICtrlCreateLabel("", $widthset, $setheight - $middle, $ItemWidth, $middle + $Size)
    GUICtrlSetBkColor(-1, $ValueMaxColor)
    GUICtrlSetFont(-1, $FontSize, $FontWeight, 0, $FontName)
    If $istring Then GUICtrlSetData(-1, StringMid($string, $i + 1, 1))
    $currentwidth[$middle] = $widthset
    $widthset += $widthtoset
    $k = 0
    $itemheight = $setheight - $middle + 1
    $itemsize = $middle + $Size - 1
    ;#####################
    ;Labels after middle
    ;#####################
    For $i = $middle + 1 To $tabsize
        $currentwidth[$i] = $widthset
        $light[$i] = GUICtrlCreateLabel("", $widthset, $itemheight, $ItemWidth, $itemsize)
        GUICtrlSetBkColor(-1, $ValueMaxColor)
        GUICtrlSetFont(-1, $FontSize, $FontWeight, 0, $FontName)
        If $istring Then GUICtrlSetData(-1, StringMid($string, $i + 1, 1))
        $widthset += $widthtoset
        $itemheight += 1
        $itemsize -= 1
    Next
    GUISetState(@SW_SHOW)
    GUISetBkColor(0x000000)
    AdlibEnable("messageHandler", 50)
    $countlimit = 0
    While 1
        If $countlimit = $Limit Then ExitLoop
        $countlimit += 1
        For $i = 0 To $tabsize
            $lightvalue[$i] = $ValueMaxColor
            $Sizevalue[$i] = $totalsize
            GUICtrlSetBkColor($light[$i], $totalsize)
            If $i <= $tabsize Then
                For $current = $i + 1 To $tabsize
                    $Sizevalue[$current] -= $SizeValueFade
                    Switch $Type
                        Case 0
                            GUICtrlSetPos($light[$current], $currentwidth[$current], 0, $ItemWidth, $Sizevalue[$current])
                        Case 1
                            GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]) / 2, $ItemWidth, $Sizevalue[$current])
                        Case Else
                            GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]), $ItemWidth, $Sizevalue[$current])
                    EndSwitch
                    $lightvalue[$current] -= $ValueFade
                    GUICtrlSetBkColor($light[$current], $lightvalue[$current])
                Next
            EndIf
            If $i > 0 Then
                For $current = $i - 1 To 0 Step - 1
                    $Sizevalue[$current] -= $SizeValueFade
                    Switch $Type
                        Case 0
                            GUICtrlSetPos($light[$current], $currentwidth[$current], 0, $ItemWidth, $Sizevalue[$current])
                        Case 1
                            GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]) / 2, $ItemWidth, $Sizevalue[$current])
                        Case Else
                            GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]), $ItemWidth, $Sizevalue[$current])
                    EndSwitch
                    $lightvalue[$current] -= $ValueFade
                    GUICtrlSetBkColor($light[$current], $lightvalue[$current])
                Next
            EndIf
            Sleep($Delay)
        Next

        If $countlimit = $Limit Then ExitLoop
        $countlimit += 1
        For $i = $tabsize To 0 Step - 1
            $lightvalue[$i] = $ValueMaxColor
            $Sizevalue[$i] = $totalsize
            GUICtrlSetBkColor($light[$i], $totalsize)
            If $i < $tabsize Then
                For $current = $i + 1 To $tabsize
                    $Sizevalue[$current] -= $SizeValueFade
                    Switch $Type
                        Case 0
                            GUICtrlSetPos($light[$current], $currentwidth[$current], 0, $ItemWidth, $Sizevalue[$current])
                        Case 1
                            GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]) / 2, $ItemWidth, $Sizevalue[$current])
                        Case Else
                            GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]), $ItemWidth, $Sizevalue[$current])
                    EndSwitch
                    $lightvalue[$current] -= $ValueFade
                    GUICtrlSetBkColor($light[$current], $lightvalue[$current])
                Next
            EndIf
            If $i > 0 Then
                For $current = $i - 1 To 0 Step - 1
                    $Sizevalue[$current] -= $SizeValueFade
                    Switch $Type
                        Case 0
                            GUICtrlSetPos($light[$current], $currentwidth[$current], 0, $ItemWidth, $Sizevalue[$current])
                        Case 1
                            GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]) / 2, $ItemWidth, $Sizevalue[$current])
                        Case Else
                            GUICtrlSetPos($light[$current], $currentwidth[$current], ($totalsize - $Sizevalue[$current]), $ItemWidth, $Sizevalue[$current])
                    EndSwitch
                    $lightvalue[$current] -= $ValueFade
                    GUICtrlSetBkColor($light[$current], $lightvalue[$current])
                Next
            EndIf
            Sleep($Delay)
        Next
    WEnd
EndFunc   ;==>_K2000
Func messageHandler()
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
EndFunc   ;==>messageHandler

Kohr

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...