Page 1 of 1

Thousands of colors (plasma cloud)

Posted: Mon Apr 13, 2020 8:11 am
by Wilshusen
Just some nice color showing on your device.
9A4B8715-2C01-4F93-B566-6441DFB99438.png
9A4B8715-2C01-4F93-B566-6441DFB99438.png (8.21 MiB) Viewed 2887 times

Re: Thousands of colors (plasma cloud)

Posted: Mon Apr 13, 2020 8:12 am
by Wilshusen
rem THOUSANDS OF COLORS (Plasma cloud)


input "Hardness (advisable 50 to 200)":hard
input "Texture style (0=diagonal, other=plain)":diag

graphics
randomize

a= rnd(1)!!a=rnd(1)
maxx=1750!!maxy=1750
maxy=SCREEN_HEIGHT()*SCREEN_SCALE()
maxx=SCREEN_WIDTH()*SCREEN_SCALE()

draw pixel maxx,maxy color rnd(1),rnd(1),rnd(1)
draw pixel maxx,0 color rnd(1),rnd(1),rnd(1)
draw pixel 0,0 color rnd(1),rnd(1),rnd(1)
draw pixel 0,maxy color rnd(1),rnd(1),rnd(1)
draw pixel maxx/2,maxy/2 color rnd(1),rnd(1),rnd(1)

draw pixel maxx/2,0 color rnd(1),rnd(1),rnd(1)
draw pixel maxx/2,maxy color rnd(1),rnd(1),rnd(1)
draw pixel 0,maxy/2 color rnd(1),rnd(1),rnd(1)
draw pixel maxx,maxy/2 color rnd(1),rnd(1),rnd(1)

iy=1
ix=maxx/2
iy=maxy/2

BUCLE:
ix=ix/2
iy=iy/2

for y=0 to maxy+1 step iy*2
for x=ix to maxx+ix step ix*2
get pixel x-ix,y color r1,g1,b1,a
get pixel x+ix,y color r2,g2,b2,a
draw pixel x,y color f((r1+r2)/2),f((g1+g2)/2),f((b1+b2)/2)
get pixel x-ix,y+iy*2 color r2,g2,b2,a
draw pixel x-ix,y+iy color f((r1+r2)/2),f((g1+g2)/2),f((b1+b2)/2)

rem get pixel x-ix,y color r1,g1,b1,a
get pixel x-ix,y+iy*2 color r3,g3,b3,a
get pixel x+ix,y color r4,g4,b4,a
get pixel x+ix,y+iy*2 color r2,g2,b2,a
if diag <>0 then draw pixel x,y+iy color f((r1+r2+r3+r4)/4),f((g1+g2+g3+g4)/4),f((b1+b2+b3+b4)/4)
if diag=0 then draw pixel x,y+iy color f((r1+r2)/2),f((g1+g2)/2),f((b1+b2)/2)

next x
next y

if ix>1 and iy>1 then goto BUCLE


def f(x)
c=x+(rnd(1)-0.5)*.hard/.maxx
if c>1 then c=1
if c<0 then c=0
f=c
end def