Amoeba

Post Reply
User avatar
rbytes
Posts: 1794
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X
iPad 4
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Amoeba

Post by rbytes » Sun Nov 25, 2018 10:37 am

I got to thinking about the poly, and how with the right code it could be a useful tool for animators. So here is the first animated movie featuring a poly. The amoeba, and its encounter with a colony of algae. Perhaps there is a composer out there who could create the dramatic score to highlight the suspense! :lol:

Code: Select all

/*
Amoeba.sb by rbytes
November 2018
Simple animation using a poly.
Amoeba narrowly escapes algae!
*/

SET TOOLBAR OFF
SET ORIENTATION LANDSCAPE
SET BUTTONS CUSTOM
RANDOMIZE
refresh off
OPTION BASE 1
laun$=LAUNCHER$ ()
dev$=DEVICE_TYPE$()
GET SCREEN SIZE sw,sh
sh2=sw*.75
iostest=0
IF iostest THEN
  sw=568
  sh=320
  dev$=""
ENDIF
rw=sw/1024!rh=sh/768
pts=50
GRAPHICS
GRAPHICS CLEAR 1,1,1
'lmargin=50*rw
'tmargin=50*rh
draw color 0,0,0
DIM a(pts),b(pts),x(pts),y(pts)
inc=.5
FOR t=1 to pts
  READ temp!x(t)=lmargin+temp!a(t)=x(t)
NEXT t
FOR t=1 to pts
READ temp!y(t)=tmargin+temp!b(t)=y(t)
NEXT t
'debug pause
dur=time()
do
FOR t=1 to pts
  x(t)=x(t)+rnd(5)-2+nudge
  if abs(x(t)-a(t))>20 then x(t)=a(t)
  a(t)=a(t)+nudge
  y(t)=y(t)+rnd(5)-2+nudge*.6
  b(t)=b(t)+nudge*.6
  if abs(y(t)-b(t))>10 then y(t)=b(t)
  Pause .001
NEXT t
Graphics clear 1,1,1
FILL COLOR 0,.6,0
fill POLY x,y
trig+=1
if trig>50 and then nudge+=inc
if time()-dur>13 then end

if y(12)>420 or on=1 then
  inc=-.4
  on=1
  FILL COLOR 1,.5,0
  fill circle sw-30-grow*10,sh-30-grow*6 size 20*grow*grow
  grow+=.06
endif

refresh
until 0

pause 5

DATA 522,519.981,513.957,504.023,490.335,473.108,452.616,429.181,403.172,374.999,345.108,313.97,282.074,249.926,218.03,186.892,157.001,128.828,102.819,79.384,58.8916,41.6655,27.9772,18.0427,12.0186,10,12.0186,18.0427,27.9772,41.6655,58.8916,79.384,102.819,128.828,157.001,186.892,218.03,249.926,282.074,313.97,345.108,374.999,403.172,429.181,452.616,473.108,490.335,504.023,513.957,519.981

DATA 163.5,182.739,201.674,220.007,237.449,253.725,268.578,281.774,293.104,302.391,309.487,314.281,316.697,316.697,314.281,309.487,302.391,293.104,281.774,268.578,253.725,237.449,220.007,201.674,182.739,163.5,144.261,125.326,106.993,89.5508,73.275,58.422,45.2262,33.8957,24.609,17.5128,12.7189,10.3029,10.3029,12.7189,17.5128,24.609,33.8957,45.2262,58.422,73.275,89.5508,106.993,125.326,144.261
Attachments
1B3B6703-ED80-4612-A5E7-B716725C0F71.png
1B3B6703-ED80-4612-A5E7-B716725C0F71.png (62.98 KiB) Viewed 32 times
7AAE3081-81AF-4DC1-8290-BA5A13CC987A.png
7AAE3081-81AF-4DC1-8290-BA5A13CC987A.png (67.54 KiB) Viewed 34 times
####### Living the colorful life #######

Post Reply