Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Sine, Cosine Visualizer by TheBaykun.
- Speed = 0.03 'Lower number: faster.
- RETINA off
- ' Tap and hold screen to pause.
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- BCOLOR 200,255,200
- TCOLOR 255,0,0
- sw=ScreenWidth
- sh=ScreenHeight
- SLEEP 0.1
- DIM wave(20),waveB(20)
- FOR i=1 TO 20
- wave(i)=sh/2
- waveB(i)=sh/2
- NEXT
- SLEEP 0.1
- COLOR 0,0,0
- CIRCLE 30,sh/2,25,3
- LINE 60,(sh/2)-28,sw-60,(sh/2)-28,3
- LINE 60,(sh/2)+28,sw-60,(sh/2)+28,3
- LINE sw-30,(sh/2)-25,sw-30,(sh/2)+25,3
- LINE sw-55,(sh/2),sw-5,(sh/2),3
- x=55
- y=(sh/2)
- a=30
- b=(sh/2)-25
- q=0 'Sine angle (red)
- w=90 'Cosine angle (blue)
- p=1
- WHILE p=1
- BEGINDRAW
- CLS
- q=q+1
- w=w+1
- IF q>359 THEN
- q=0
- ENDIF
- IF w>359 THEN
- w=0
- ENDIF
- x=30+(25*SIN(q))
- y=(sh/2)+(25*COS(q))
- a=30+(25*SIN(w))
- b=(sh/2)+(25*COS(w))
- GOSUB drawCircle
- GOSUB drawWave
- GOSUB drawCross
- SLEEP speed
- IF q>=267 THEN
- PRINT "Sorry, the math is not accurate."
- PRINT "It will automatically fix itself"
- PRINT "in",1+INT((360-q)/10),"..."
- ENDIF
- WHILE Touch>0
- WEND
- ENDDRAW
- WEND
- drawCircle:
- COLOR 0,0,0
- CIRCLE 30,sh/2,25,3
- COLOR 255,0,0
- CIRCLE x,y,2
- COLOR 0,0,255
- CIRCLE a,b,2
- RETURN
- drawWave:
- GOSUB updateWave
- COLOR 0,0,0
- LINE 60,(sh/2)-28,sw-60,(sh/2)-28,3
- LINE 60,(sh/2)+28,sw-60,(sh/2)+28,3
- FOR i=1 TO 19
- COLOR 255,0,0
- LINE (60-((sw-60)/25))+((sw-60)/25)*i,wave(i),(60-((sw-60)/25))+((sw-60)/25)*(i+1),wave(i+1)
- COLOR 0,0,255
- LINE (60-((sw-60)/25))+((sw-60)/25)*i,waveB(i),(60-((sw-60)/25))+((sw-60)/25)*(i+1),waveB(i+1)
- NEXT
- RETURN
- drawCross:
- COLOR 0,0,0
- LINE sw-30,(sh/2)-25,sw-30,(sh/2)+25,3
- LINE sw-55,(sh/2),sw-5,(sh/2),3
- COLOR 255,0,0
- CIRCLE sw-30,y,2
- CIRCLE (x-30)+(sw-30),sh/2,2
- COLOR 0,0,255
- CIRCLE sw-30,b,2
- CIRCLE (a-30)+(sw-30),sh/2,2
- RETURN
- updateWave:
- FOR i=19 TO 1 STEP -1
- wave(i+1)=wave(i)
- waveB(i+1)=waveB(i)
- NEXT
- wave(1)=y
- waveB(1)=b
- RETURN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement