A simple Spiroplayer

Post Reply
smbstarv
Posts: 54
Joined: Wed Nov 27, 2013 3:44 pm
My devices: Ipad 6th gen
Flag: Netherlands
Contact:

A simple Spiroplayer

Post by smbstarv »

REM***** a simple spiroplayer ***** smbstarv
SET ORIENTATION 2
GRAPHICS
GRAPHICS CLEAR 0,0,0
mx=SCREEN_WIDTH()/2 'midscreen coordinates
my=SCREEN_HEIGHT()/2
OPTION ANGLE DEGREES
ra=300 'init radius outerwheel a
rb=70 'init radius innerwheel b
di=50 'drawing point, init distance TO CENTRAL point of innerwheel
sp=1 'init speed

BUTTON "pars" TEXT "CHANGE PAR's" AT 50,50

anew:
DRAW CIRCLE mx,my SIZE ra 'outerwheel
DRAW TEXT "ra = "&STR$(ra) AT 10,100
DRAW TEXT "rb = "&STR$(rb) AT 10,120
DRAW TEXT "di = "&STR$(di) AT 10,140
DRAW TEXT "speed="&STR$(sp) AT 10,160
'
SPRITE "b" BEGIN 4*rb,4*rb
OPTION SPRITE POS CENTRAL
DRAW CIRCLE 2*rb,2*rb SIZE rb 'innerwheel
'
rc=5
FOR g=0 TO 500
DRAW CIRCLE 2*rb+rc*COS(g),2*rb+rc*SIN(g) SIZE .05'spiral in innerwheel
rc=rc*(1+1/720)
NEXT g
'
FILL COLOR 1,0,0
FILL CIRCLE 2*rb+di,2*rb SIZE 3 'red drawing point
SPRITE END
SPRITE "b" AT mx+ra-rb,my
SPRITE "b" SHOW
PAUSE 1

FOR alfa=0 TO 8000 STEP .2
IF BUTTON_PRESSED("pars")=1 THEN
GOTO newpars
END IF

SPRITE "b" AT mx+(ra-rb)*COS(alfa), my+(ra-rb)*SIN(alfa) ANGLE -alfa*(ra/rb-1)
GET SPRITE "b" POS x,y
GET SPRITE "b" ANGLE a
FILL COLOR 0,1,0
FILL CIRCLE x+di*COS(a),y+di*SIN(a) SIZE .1'green trajectory of drawing point
PAUSE .01/sp
NEXT alfa

newpars:
TEXT CLEAR
BUTTON "pars" HIDE
PRINT "Type ""a"" to change radius of outerwheel ("&STR$(ra)&")"
PRINT "Type ""b"" to change radius of innerwheel ("&STR$(rb)&")"
PRINT "Type ""d"" to change distance to drawingpoint ("&STR$(di)&")"
PRINT "Type ""s"" to change drawing speed ("&STR$(sp)&")"
PRINT "Type ""r"" to Return"
PRINT

INPUT m$
IF m$="a" THEN INPUT ra
IF m$="b" THEN INPUT rb
IF m$="d" THEN INPUT di
IF m$="s" THEN INPUT sp
IF m$="r" THEN GOTO new1
GOTO newpars

new1:
GRAPHICS
GRAPHICS CLEAR 0,0,0
BUTTON "pars" SHOW

GOTO anew

Post Reply