Sphere ( animated )
Posted: Thu May 09, 2013 10:13 am
Yuhuu,
this is my first snippet post on this forum,
took a bit for porting ( now learning smart basic )
enjoy...
REM Rotating Pseudo Sphere by Operator
REM inspired by DrChip, ported from Basic!
REM smart Basic 2.0.1 / iPhone 4 / iOS 6.1
option angle radians
PI = 3.14159265
graphics
draw color 1,1,1
scwh = Screen_Width()/2
schh = Screen_Height()/2
sizee = 120 ' radius of the sphere
segments = 11 ' segment of the sphere
loop:
graphics lock
' clear the background
fill color 0,0,1
fill circle scwh,schh SIZE sizee
' sphere segment rotation increment
a = a + PI/(2*segments)
draw color 1,1,1
' draw sphere
draw size 1
FOR i = 0 TO PI STEP PI/segments
draw circle scwh-sizee*SIN(i+a), schh-sizee TO scwh+sizee*SIN(i+a),schh+sizee
draw circle scwh-sizee,schh-sizee*SIN(i) TO scwh+sizee,schh+sizee*SIN(i)
NEXT i
' overlay fading circles over the sphere
draw size 5.1
FOR i = 1 TO sizee STEP 5
alf = 0.98-(i*0.9/sizee)
draw alpha alf
draw COLOR 0,0,0
draw CIRCLE scwh,schh SIZE sizee-(i)
NEXT i
draw alpha 1
' last circle overlay
draw size 5
draw COLOR 0,0,0
draw CIRCLE scwh,schh SIZE sizee
graphics unlock
pause 0.1
GOTO loop
this is my first snippet post on this forum,
took a bit for porting ( now learning smart basic )
enjoy...
REM Rotating Pseudo Sphere by Operator
REM inspired by DrChip, ported from Basic!
REM smart Basic 2.0.1 / iPhone 4 / iOS 6.1
option angle radians
PI = 3.14159265
graphics
draw color 1,1,1
scwh = Screen_Width()/2
schh = Screen_Height()/2
sizee = 120 ' radius of the sphere
segments = 11 ' segment of the sphere
loop:
graphics lock
' clear the background
fill color 0,0,1
fill circle scwh,schh SIZE sizee
' sphere segment rotation increment
a = a + PI/(2*segments)
draw color 1,1,1
' draw sphere
draw size 1
FOR i = 0 TO PI STEP PI/segments
draw circle scwh-sizee*SIN(i+a), schh-sizee TO scwh+sizee*SIN(i+a),schh+sizee
draw circle scwh-sizee,schh-sizee*SIN(i) TO scwh+sizee,schh+sizee*SIN(i)
NEXT i
' overlay fading circles over the sphere
draw size 5.1
FOR i = 1 TO sizee STEP 5
alf = 0.98-(i*0.9/sizee)
draw alpha alf
draw COLOR 0,0,0
draw CIRCLE scwh,schh SIZE sizee-(i)
NEXT i
draw alpha 1
' last circle overlay
draw size 5
draw COLOR 0,0,0
draw CIRCLE scwh,schh SIZE sizee
graphics unlock
pause 0.1
GOTO loop