Spinning Lines (iPad/iPhone)

Post Reply
User avatar
Dav
Posts: 279
Joined: Tue Dec 30, 2014 5:12 pm
My devices: iPad Mini, iPod Touch.
Location: North Carolina, USA
Contact:

Spinning Lines (iPad/iPhone)

Post by Dav »

Playing around with sprites again. This draws multicolor lines in a circle pattern and spins it around like a pin wheel. Can make you dizzy after a while.

Touch screen for different zoom and alpha levels. Touch higher up on screen to get closer zoom level, lower touch makes less zoom level.

- Dav

Code: Select all

'Spinning color lines using sprite.
'Touch screen for different zoom
'and alpha level. Touch higher on
'screen for closer zoom levels, and
'lower on screen for further away.
'Coded by Dav

graphics
option sprite pos central 'center sprites

x=screen_width()/2
y=screen_height()/2

refresh off
draw size 2
shadow on
for a = 1 to 1975 step 10
  d = a*360
  x2 = cos(d) * y
  y2= sin(d) * y
  r=rnd(255) ! g=rnd(255) ! b=rnd(255)
  draw color r/255,g/255,b/255
  draw line x,y to x+x2,y+y2
next a

sprite "s" scan 0,0,x*2,y*2
sprite "s" show
graphics clear 0,0,0
refresh on

retouch:

a=rnd(50000)+1001 'random zoom value
al=rnd(100)+20  'random alpha level
'higher touches make closer zooms...
if touch_y(0)>0 then a=a/touch_y(0)*500

do
    sprite "s" alpha al/100
    sprite "s" at x,y scale a/1000 angle a/100
    'keep pos if orintation changed
    if screen_width()/2<>x then
      x=screen_width()/2
      y=screen_height()/2
    end if
    a=a+1 ! pause .005
    if touch_x(0)<>-1 then goto retouch
until 0
Attachments
spinninglines.jpg
spinninglines.jpg (123.4 KiB) Viewed 1985 times

Post Reply