Page 1 of 1

Color gradient

Posted: Fri Aug 30, 2013 3:45 pm
by Mr. Kibernetik

Code: Select all

graphics
maxx = screen_width() * screen_scale() - 1
maxy = screen_height() * screen_scale() - 1
for y=0 to maxy
  g=y/maxy
  for x=0 to maxx
    r=x/maxx
    b=abs(r-g)
    draw pixel x,y color r,g,b
  next x
next y

Re: Color gradient

Posted: Fri Aug 30, 2013 5:07 pm
by Mr. Kibernetik
More interesting version:

Code: Select all

graphics
maxx = screen_width() * screen_scale() - 1
maxy = screen_height() * screen_scale() - 1
for y=0 to maxy
  g=y/maxy
  for x=0 to maxx
    r=x/maxx
    b=abs(r-g)
    draw pixel x,y color r,g,b
  next x
next y
loop:
for y=0 to maxy
  for x=0 to maxx
    get pixel x,y color r,g,b
    draw pixel x,y color 1-g,1-b,1-r
  next x
next y
goto loop