Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with RGB
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Flashkicks




PostPosted: 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 */
~Fashkicks
Sponsor
Sponsor
Sponsor
sponsor
Delta




PostPosted: Mon Apr 26, 2004 12:01 pm   Post subject: (No subject)

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

heres black to yellow

code:
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
code:
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)

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




PostPosted: Mon Apr 26, 2004 12:38 pm   Post subject: (No 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-
Flashkicks
Delta




PostPosted: Mon Apr 26, 2004 1:11 pm   Post subject: (No subject)

Ok...
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)
Flashkicks




PostPosted: Mon Apr 26, 2004 6:33 pm   Post subject: (No 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!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: