Color gradient

Post Reply
User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Color gradient

Post 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

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Color gradient

Post 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

Post Reply