Drawing rainbow colour cycles

Previous topic - Next topic

Kitty Hello

Code (glbasic) Select

DIM pix%[256]
FOR i=0 TO 255
LOCAL r,g,b
r = 0.5 + SIN( i    /255 * 360.)/2.0
g = 0.5 + SIN((i+85)/255 * 360.)/2.0
b = 0.5 + SIN((i+170)/255 * 360.)/2.0
pix[i] = RGB(r*255, g*255, b*255) + 0xff000000
NEXT
MEM2SPRITE(pix%[], 1, 256,1)
STRETCHSPRITE 1, 0,150, 256,32


Totally non-optimized code. But you can use the texture later, which is OK.
I use it to track the colour bugs in the RaspberryPi setup...

mentalthink

This it's usefully for some drawing or modify image tool... THX

Ian Price

That's a really nice effect. Cheers Gernot  :)
I came. I saw. I played.