Computer Science Canada

Rainbow effect

Author:  Zero [ Fri Nov 28, 2003 10:03 am ]
Post subject:  Rainbow effect

Well i was hoping that some one here could explain why this happens:
useing my oval (again) as an exmple; it works with anything aslong as you have a "for x/y:" as far as i know.

code:
setscreen ("graphic:vga")
for x : 0 .. 100 by 10
    for y : 0 .. 100 by 10
        drawoval (320, 240, x, y, y)
         delay(5)
    end for
end for


Why is it when you put the X or Y variable in for a colour you get this rainbow aray of colours for that shape?

(It turned out better then i thought, as one of my friends spent about aday or two trying to get this effect and now i get to rub it in his face Laughing )

Author:  Tony [ Fri Nov 28, 2003 10:13 am ]
Post subject: 

because colors are represeted by a value 0-255

so since your x variable changes (because of the forloop), so are the colors that are being used for the ovals

Author:  Zero [ Fri Nov 28, 2003 10:38 am ]
Post subject: 

ooohhh, ok cool, Thanks Tony

and i hope this time the topic name is more to your liking Smile


: