• Welcome to Dark Bit Factory & Gravity.
 

Line_Color_Fader problems...

Started by GfxFreak, August 15, 2012

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

GfxFreak

Hi I have a question.
How do you program a line fader effect of oldschool demos?

For i As Integer = 0 To 255

line, (i +20.20) - (i, 30), RGB (r, g, b)

Next


Which algorithm for the colors should I use?

combatking0

You may want to store 2 values for each colour component - the "base" values (which for orange, might be
rBase = 1,
gBase = 0.5,
bBase = 0), and then multiply these base values by the i variable (
rOut = rBase * i,
gOut = gBase * i,
bOut = bBase * i).

This may result in floating point values, so be sure to convert them to integers before applying them as the line colours.
You are our 9001st visitor.
Challenge Trophies Won:

Jim

Or, exactly the same but using adding


r = 0
g = 0
b = 0
rBase = 1
gbase = 0.5
bBase = 0
For i As Integer = 0 To 255

line, (i +20.20) - (i, 30), RGB (r, g, b)

r = r + rBase
g = g + gBase
b = b + bBase

Next


Jim
Challenge Trophies Won:

GfxFreak

Thx...
This works so. well ever but I want the color of the left move to the right


Jim

If you fill in startRGB and endRGB then this will do a line from any colour to any other colour over a number of steps

steps = 255
startR = ?
startG = ?
startB = ?
endR = ?
endG = ?
endB = ?
r = startR
g = startG
b = startB
rBase = (endR - startR) / steps
gBase = (endG - startG) / steps
bBase = (endB - startB) / steps
For i As Integer = 0 To steps
  line, (i +20.20) - (i, 30), RGB (r, g, b)
  r = r + rBase
  g = g + gBase
  b = b + bBase
Next


Jim
Challenge Trophies Won:

GfxFreak

It works perfect jim but i need an animation from left to right :(

Shockwave

I believe that this;

http://www.dbfinteractive.com/forum/index.php?topic=1555.msg23684#msg23684

Will give you the effect you're looking for... Just restrict the height to 1 line. :)
Shockwave ^ Codigos
Challenge Trophies Won: