Gradient Bars Edit

Started by Vexus, February 22, 2012, 05:33:46 pm

Previous topic - Next topic

Vexus

There's this menu script of ryex: http://forum.chaos-project.com/index.php/topic,2365.0.html and frankly I don't like the black border of the gradient bars and was wondering if it's possible to fix it into something neater.

I I hope it's not something hard to edit but that black border doesn't look good at all and even though I tried searching I have no idea how to change it as I don't know how to script.

Thanks.
Current Project/s:

Vexus

Current Project/s:

Poe

define "something neater".

that's what a gradient is isn't it, from dark to light to dark again.

Vexus

Something like this: http://www.adobetutorialz.com/content_images/AdobePhotoshop/TextEffects/ferrari/gradient.jpg

Meaning from darker to brighter instead of how it's currently (Darker on top and bottom and brighter in the middle).
Current Project/s:

Poe

February 27, 2012, 05:27:28 am #4 Last Edit: February 27, 2012, 05:29:36 am by Poe
class Bitmap
 def draw_bar_ryex(x, y, w, h, p, c)
   gray = Color.new(100, 100, 100)
   # border
   fill_rect(x, y, w, h, Color.new(0, 0, 0))
   
   # horizontal gradients:
   # where no coloured bar is shown.
   for i in 0..w - 3
     gr = gray.red * i / w
     gg = gray.green * i / w
     gb = gray.blue * i / w
     #fill_rect(x+1+i,y+1,1,h-2,Color.new(gr, gg, gb)) #normal
     fill_rect(x+w-1-i,y+1,1,h-2,Color.new(gr, gg, gb)) #reverse
   end

   # coloured bar.
   for i in 0..(p * (w - 3))
     r = c.red * i / w
     g = c.green * i / w
     b = c.blue * i / w
     fill_rect(x+1+i,y+1,1,h-2,Color.new(r, g, b))
   end
   
 end
end

replace line 144-175 with this code.

i made the gray gradient (bar background) go from light to dark because at a certain value the gray background and coloured foreground of the bar become indistinguishable, but you can change it back if you want by putting the # from the #normal line to the #reverse line.

Vexus

Current Project/s: