|
| 1 | +REM SmallBASIC |
| 2 | +REM created: 13/08/2019 |
| 3 | +option predef load modules |
| 4 | +import android |
| 5 | + |
| 6 | +android.sensor_on(0) |
| 7 | +randomize ticks |
| 8 | +x=xmax/2 |
| 9 | +y=ymax/2 |
| 10 | +np=60 |
| 11 | +gap=7 |
| 12 | +ar=[] |
| 13 | + |
| 14 | +func mk(n) |
| 15 | + local r |
| 16 | + r.co=rgb(90-n,90-n,n)'rnd*15 |
| 17 | + r.p1=rnd*360 |
| 18 | + r.p2=rnd*360 |
| 19 | + r.dr=iff(n mod 2==1,1,0) |
| 20 | + r.s=rnd*900 |
| 21 | + r.n=n+5 |
| 22 | + return r |
| 23 | +end |
| 24 | + |
| 25 | +sub sh(i,of,ac) |
| 26 | + local r,s,e,j |
| 27 | + j=iff(ar[i].dr==1, of, -of) |
| 28 | + s=rad(ar[i].p1+j+ar[i].s) |
| 29 | + e=rad(ar[i].p2+j+ar[i].s) |
| 30 | + r=ar[i].n*gap |
| 31 | + arc x,y,r,s,e,1,ar[i].co |
| 32 | + if i==ac then |
| 33 | + arc x,y,r+1,s,e,1,ar[i].co |
| 34 | + arc x,y,r-1,s,e,1,ar[i].co |
| 35 | + arc x,y,r+2,s,e,1,ar[i].co |
| 36 | + arc x,y,r-2,s,e,1,ar[i].co |
| 37 | + endif |
| 38 | +end |
| 39 | + |
| 40 | +for i = 0 to np - 1 |
| 41 | + ar<<mk(i) |
| 42 | +next i |
| 43 | + |
| 44 | +of=0 |
| 45 | +ac=10 |
| 46 | +nn=1 |
| 47 | +t=10 |
| 48 | +while 1 |
| 49 | + of=(of+10) mod 360 |
| 50 | + nn=(nn+1) mod (np-1) |
| 51 | + s=android.sensor |
| 52 | + x+=s.y*100 |
| 53 | + y+=s.x*100 |
| 54 | + if x<0 then x=0 |
| 55 | + if x>xmax then x=xmax |
| 56 | + if y<0 then y=0 |
| 57 | + if y>ymax then y=ymax |
| 58 | + if ac>0 and s.y*s.x < 0 then ac-=1 |
| 59 | + if ac<np-1 and s.y*s.x > 0 then ac+=1 |
| 60 | +' if ac==0 then exit loop |
| 61 | + cls |
| 62 | + 'print ac+ " "+s.z |
| 63 | + for i = 0 to np-1 |
| 64 | + sh(i,of,ac) |
| 65 | + next i |
| 66 | + |
| 67 | + showpage |
| 68 | + delay t |
| 69 | +wend |
| 70 | + |
| 71 | + |
0 commit comments