GeoSym

Post Reply
dpletts
Posts: 2
Joined: Mon Jan 27, 2014 3:08 pm

GeoSym

Post by dpletts »

This is a simple program with a (sometimes) colourful result.

graphics
randomize
set toolbar off
set orientation 4
maxx1 = screen_width()
maxy1 = screen_height()

minx = (maxx1- maxy1)/2
miny = 0
maxx = minx+maxy1
maxy = maxy1
cx = minx + (maxx-minx)/2
cy = maxy1/2
nc = 30
gosub setcolours


here:
graphics clear 1,1,1
fill color .4+ rnd(.4),.4+ rnd(.4),.4+ rnd(.4)
fill rect minx,miny to maxx,maxy
gosub changecolours
for i = 1 to 5 + rnd(4)
rn = rnd(4)
c=rnd(nc)
fill color colsr(c),colsg(c),colsb(c)
graphics mode overlay
if rnd(4) = 0 and i < 3 then graphics mode normal
if rn = 0 then csquare()
if rn = 1 then ccircle()
if rn = 2 then cdiamond()
if rn = 3 then
if rz = 1 then
ccross()
endif
endif
next i
for i = 1 to rnd(3)+2
sdisk()
next i
for i = 1 to rnd(3)+2
ssquare()
next i
gosub dotch
graphics mode normal
goto here



saveit:
GRAPHICS SAVE minx,miny, maxy,maxy TO "out.png"
ALBUM EXPORT "out.png"
return


setcolours:
cv = 1
dim colsr(30)
dim colsg(30)
dim colsb(30)
for ci = 0 to 29

colsr(ci) = rnd(cv)
colsg(ci) = rnd(cv)
colsb(ci) = rnd(cv)
next ci
return


changecolours:
cv=1
for ci = 0 to 29
colsr(ci) = rnd(cv)
colsg(ci) = rnd(cv)
colsb(ci) = rnd(cv)
next ci
return

dotch:
xx = -1
do
get touch 0 as xx,yy
until xx > -1
if xx < minx then gosub saveit
'get touch 1 as xx,yy
if xx > maxx then
graphics mode normal
graphics clear 1,1,1
end
endif
return




def ccircle()
s = 50 + rnd(.maxy/2-50)
fill circle .cx,.cy size s
end def

def csquare()
s = 100 + rnd(.maxy/2-100)
fill rect .cx,.cy size s
end def

def cdiamond()
adon = rnd(.maxy/2-100)+ 100
if i > 30 then adon = rnd(60) + 10
px(0) = .cx-adon
py(0) = .cy
px(2) = .cx+adon
py(2) = .cy
px(1) = .cx
py(1) = .cy-adon
px(3) = .cx
py(3) = .cy + adon
fill poly px,py count 4 start 0
end def

def ccross()
w = rnd(50)+ 50
fill rect .cx - w,.miny to .cx + w,.maxy
fill rect .minx, .cy - w to .maxx,.cy + w
end def

def ssquare()
s = rnd(50) + 50
d = rnd(.maxy/3.5)+ 50
x1 = .cx - d
y1 = .cy - d
fill rect x1,y1 size s
x2 = .cx + d
y2 = .cy - d
fill rect x2,y2 size s
x3 = .cx - d
y3 = .cy + d
fill rect x3,y3 size s
x4 = .cx + d
y4 = .cy + d
fill rect x4,y4 size s
end def

def sdisk()
s = rnd(50) + 50
d = rnd(.maxy/3.5)+ 50
x1 = .cx - d
y1 = .cy - d
fill circle x1,y1 size s
x2 = .cx + d
y2 = .cy - d
fill circle x2,y2 size s
x3 = .cx - d
y3 = .cy + d
fill circle x3,y3 size s
x4 = .cx + d
y4 = .cy + d
fill circle x4,y4 size s
end def

image.jpg
image.jpg (52.69 KiB) Viewed 1781 times
image.jpg
image.jpg (54.74 KiB) Viewed 1781 times
image.jpg
image.jpg (73.24 KiB) Viewed 1781 times
image.jpg
image.jpg (49.56 KiB) Viewed 1781 times

dpletts
Posts: 2
Joined: Mon Jan 27, 2014 3:08 pm

Re: GeoSym

Post by dpletts »

Forgot to say that tapping an image will produce a new image; tapping the white area on the left will save the image to the Camera Roll and then produce a new image; tapping the white area on the right will stop the production of images.

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: GeoSym

Post by Mr. Kibernetik »

Very interesting!

Post Reply