Collect some nice pictures (iPads and iPhones)

Post Reply
Henko
Posts: 834
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Collect some nice pictures (iPads and iPhones)

Post by Henko »

IMG_1351.png
IMG_1351.png (657.43 KiB) Viewed 126 times

Code: Select all

graphics ! graphics clear .8,.8,.8 ! draw color 0,0,0
get screen size sw,sh
m=15 ! w=floor((sw-3*m)/2) ! h=floor((sh-3*m)/2)
draw text "touch any pict to change it" at 10,300 ! pause 2
graphics clear .8,.8,.8
for k=1 to 4
  art(m+(w+m)*even(k),m+(h+m)*floor(k/2.1),w,h)
  next k
while(1)
  art(m+(w+m)*even(k),m+(h+m)*floor(k/2.1),w,h)
  do slowdown
    get touch 0 as x,y ! if x=-1 then continue
    k=floor(2*x/sw)+2*floor(2*y/sh)+1 ! break
    until forever
  end while
end

' generated picture
' graphics mode assumed
' x,y,w,h are position and size of the picture
'
def art(x,y,w,h)
if not init then ! randomize ! init=1 ! end if
refresh off ! draw color .5,.5,.5
w-=odd(w) ! t=6 ! npx=w/2-t ! npy=h/2-t
xs=x+t/3-1 ! ys=y+t/3-1 ! toggle=0
dim va(npx+2),vb(npx+2),r(11)
draw size t ! draw rect x,y to x+w-t-1,y+h-t
  for i=1 to 10 ! r(i)=rnd(4) ! next i
  for i=1 to npx ! va(i)=rnd(4) ! next i
  for k=0 to npy ! yy=ys+2*k+2
    for i=1 to npx
      if toggle=0 then ! s=r(va(i-1)+va(i)+va(i+1)) ! vb(i)=s
        else ! s=r(vb(i-1)+vb(i)+vb(i+1)) ! va(i)=s
        end if
      if s=0 then fill color 0,0,1
      if s=1 then fill color 1,0,0
      if s=2 then fill color 0,1,0
      if s=3 then fill color 0,0,1
'     fill color bit(s,0),bit(s,1),bit(s,2)
      xx=xs+2*i ! fill rect xx,yy to xx+1,yy+1
      next i ! toggle=1-toggle
    next k
refresh
end def
IMG_1350.png
IMG_1350.png (672.97 KiB) Viewed 126 times

Henko
Posts: 834
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Collect some nice pictures (iPads and iPhones)

Post by Henko »

Henko wrote:
Wed Sep 10, 2025 11:18 am
IMG_1351.png

Code: Select all

graphics ! graphics clear .8,.8,.8 ! draw color 0,0,0
get screen size sw,sh
m=15 ! w=floor((sw-3*m)/2) ! h=floor((sh-3*m)/2)
draw text "touch any pict to change it" at 10,300 ! pause 2
graphics clear .8,.8,.8
for k=1 to 4
  art(m+(w+m)*even(k),m+(h+m)*floor(k/2.1),w,h)
  next k
while(1)
  art(m+(w+m)*even(k),m+(h+m)*floor(k/2.1),w,h)
  do slowdown
    get touch 0 as x,y ! if x=-1 then continue
    k=floor(2*x/sw)+2*floor(2*y/sh)+1 ! break
    until forever
  end while
end

' generated picture
' graphics mode assumed
' x,y,w,h are position and size of the picture
'
def art(x,y,w,h)
if not init then ! randomize ! init=1 ! end if
refresh off ! draw color .5,.5,.5
w-=odd(w) ! t=6 ! npx=w/2-t ! npy=h/2-t
xs=x+t/3-1 ! ys=y+t/3-1 ! toggle=0
dim va(npx+2),vb(npx+2),r(11)
draw size t ! draw rect x,y to x+w-t-1,y+h-t
  for i=1 to 10 ! r(i)=rnd(4) ! next i
  for i=1 to npx ! va(i)=rnd(4) ! next i
  for k=0 to npy ! yy=ys+2*k+2
    for i=1 to npx
      if toggle=0 then ! s=r(va(i-1)+va(i)+va(i+1)) ! vb(i)=s
        else ! s=r(vb(i-1)+vb(i)+vb(i+1)) ! va(i)=s
        end if
      if s=0 then fill color 1,1,0
      if s=1 then fill color 1,0,0
      if s=2 then fill color 0,1,0
      if s=3 then fill color 0,0,1
'     fill color bit(s,0),bit(s,1),bit(s,2)
      xx=xs+2*i ! fill rect xx,yy to xx+1,yy+1
      next i ! toggle=1-toggle
    next k
refresh
end def
IMG_1350.png

Chooch912
Posts: 50
Joined: Thu Apr 12, 2018 6:16 pm
My devices: iPad
Flag: United States of America

Re: Collect some nice pictures (iPads and iPhones)

Post by Chooch912 »

Awesome! Fun to play with. Thank you for sharing.

Henko
Posts: 834
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Collect some nice pictures (iPads and iPhones)

Post by Henko »

Henko wrote:
Wed Sep 10, 2025 11:18 am
IMG_1351.png

Code: Select all

graphics ! graphics clear .8,.8,.8 ! draw color 0,0,0
get screen size sw,sh
m=15 ! w=floor((sw-3*m)/2) ! h=floor((sh-3*m)/2)
draw text "touch any pict to change it" at 10,300 ! pause 2
graphics clear .8,.8,.8
for k=1 to 4
  art(m+(w+m)*even(k),m+(h+m)*floor(k/2.1),w,h)
  next k
while(1)
  art(m+(w+m)*even(k),m+(h+m)*floor(k/2.1),w,h)
  do slowdown
    get touch 0 as x,y ! if x=-1 then continue
    k=floor(2*x/sw)+2*floor(2*y/sh)+1 ! break
    until forever
  end while
end

' generated picture
' graphics mode assumed
' x,y,w,h are position and size of the picture
'
def art(x,y,w,h)
if not init then ! randomize ! init=1 ! end if
refresh off ! draw color .5,.5,.5
w-=odd(w) ! t=6 ! npx=w/2-t ! npy=h/2-t
xs=x+t/3-1 ! ys=y+t/3-1 ! toggle=0
dim va(npx+2),vb(npx+2),r(11)
draw size t ! draw rect x,y to x+w-t-1,y+h-t
  for i=1 to 10 ! r(i)=rnd(4) ! next i
  for i=1 to npx ! va(i)=rnd(4) ! next i
  for k=0 to npy ! yy=ys+2*k+2
    for i=1 to npx
      if toggle=0 then ! s=r(va(i-1)+va(i)+va(i+1)) ! vb(i)=s
        else ! s=r(vb(i-1)+vb(i)+vb(i+1)) ! va(i)=s
        end if
      s+=1 ! fill color bit(s,0),bit(s,1),bit(s,2)
      xx=xs+2*i ! fill rect xx,yy to xx+1,yy+1
      next i ! toggle=1-toggle
    next k
refresh
end def
IMG_1350.png

Post Reply