Computer Science Canada

Help with RGB

Author:  Flashkicks [ Mon Apr 26, 2004 10:32 am ]
Post subject:  Help with RGB

I am trying to figure out how I would use a 'for i' statement in creating a fading color using RGB. For example- if I were to be making flames Id have it fade from a light orange to darkOrange to black[assuming the background is black.] Same if I were to be making the Matrix falling code thingy- it goes from green to black.. So- can anyone out there type up and example maybe using green and then another color so I can SEE wut is changing..??.. I am getting confused and cant get it to werk...

/* First time experimenting with RGB Embarassed */

Author:  Delta [ Mon Apr 26, 2004 12:01 pm ]
Post subject: 

Jeez!!!! I just posted and it didn't work! Evil or Very Mad but ya.... as I was saying

heres black to yellow

var clr : int
for i : 0 .. 15
clr := RGB.AddColour (i/15, i/15, .24)
drawfilloval (10, 10, 10, 10, clr)
delay (100)
end for

for black to green change the 3rd line to
clr := RGB.AddColour (0, i/15, 0)

to make it green to black reverse the order the colours are called
(after you make them all)

for decreasing i : 15..0
drawfilloval (10, 10, 10, 10, 254+i)
delay (100)
end for

Author:  Flashkicks [ Mon Apr 26, 2004 12:38 pm ]
Post subject: 

okay- everything werks fine. but do you think you could explain wut exactely you are doing when you put "i/15" ??... Wut dose this do?
Thanks man-

Author:  Delta [ Mon Apr 26, 2004 1:11 pm ]
Post subject: 

we're taking 15 and dividing it by i
so0o0o we never get an answer higher than 1
its giving us 15 different colours

like this (5 colours)
RGB.AddColour (1.0, 0.2,1.0)
RGB.AddColour (1.0, 0.4,1.0)
RGB.AddColour (1.0, 0.6,1.0)
RGB.AddColour (1.0, 0.8,1.0)
RGB.AddColour (1.0, 0.99,1.0)

Author:  Flashkicks [ Mon Apr 26, 2004 6:33 pm ]
Post subject: 

o0o0o0Kay!..still a BIT confused.. But Ill just gfet more help from u in school tomorrow if I need it.. but thanks man!! your the best!