Cool Rings v2 fixed

Post Reply
DrChip
Posts: 167
Joined: Wed Oct 22, 2014 3:26 pm
My devices: iPhone 4 to 6+,iPad mini to iPad air 2

Cool Rings v2 fixed

Post by DrChip »

REM Cool Rings v2.0
REM v2 - bugs fixed
REM iPhone 6 plus / 8.3 b1
REM DIGIT is my son, please be nice... :)

GOSUB setup

loop:
refresh off
graphics clear 0,0,0
GOSUB rotate
GOSUB stars
GOSUB drawcircle
GOSUB msg
refresh on
GOTO loop

rotate:
xr1=xr1+1
yr1=yr1+1
IF xr1>360 THEN
xr1=xr1-360
END IF
IF yr1>360 THEN
yr1=yr1-360
END IF

FOR b=1 TO 2
IF b=1 THEN
xr=xr1
END IF
IF b=2 THEN
xr=1
END IF
IF b=1 THEN
yr=1
END IF
IF b=2 THEN
yr=yr1
END IF

FOR a=0 TO pts
x1=x(a,b)
y1=y(a,b)
z1=z(a,b)
xx1=x1
yy1=y1*cosi(xr)+z1*sine(xr)
zz1=z1*cosi(xr)-y1*sine(xr)
y1=yy1
x1=xx1*cosi(yr)-zz1*sine(yr)
z1=xx1*sine(yr)+zz1*cosi(yr)
zz1=z1
xx1=x1*cosi(zr)-y1*sine(zr)
yy1=x1*sine(zr)+y1*cosi(zr)

dx(a,b)=xx1
dy(a,b)=yy1
dz(a,b)=zz1
xx(a,b)=dx(a,b)/((dz(a,b)/focus)+1)+sw/2
yy(a,b)=dy(a,b)/((dz(a,b)/focus)+1)+sh/2
NEXT a
NEXT b
RETURN

stars:
FOR a=0 TO s
sxx(a)=sx(a)/((sz(a)/focus))+sw/2
syy(a)=sy(a)/((sz(a)/focus))+sh/2
col=((500-sz(a))/4)/255
fill COLOR col,col,col
fill RECT sxx(a),syy(a) to sxx(a)+3,syy(a)+3
sz(a)=sz(a)-15
IF sz(a)<-500 THEN
sz(a)=500
END IF
NEXT a
RETURN

drawcircle:
FOR b=1 TO 2
'new curve
FOR a=1 TO pts-1
c=(dz(a,b)+size)
IF b=1 THEN
draw COLOR 8*c/255,4*c/255,1.3*c/255
end if
IF b=2 THEN
draw COLOR 6*c/255,1.2*c/255,1.4*c/255
end if
draw LINE xx(a,b),yy(a,b) to xx(a+1,b),yy(a+1,b)
NEXT a
draw LINE xx(a,b),yy(a,b) to xx(1,b),yy(1,b)
NEXT b
RETURN

msg:
mc=mc-1
IF mc<20 THEN
mc= 200
m = m+1
END IF

IF m>(dp-1) THEN
m=1
END IF

draw COLOR 4*mc/255,95*mc/255,1.50*mc/255
lx=LEN(m$(m))
DRAW TEXT m$(m) at (sw/2)-lx*5,75
RETURN

setup:
graphics
sw=Screen_Width()
sh=Screen_Height()
pi=3.1415
mc=200
pts=24 'lines in circle. 5-100 more = smooth
focus=500
size=100
s=30 ' number of stars at once
m=1
xr=1
yr=2
zr=3
READ dp
DIM sx(s+1),sy(s+1),sz(s+1),sxx(s+1),syy(s+1)
DIM x(pts+2,3),y(pts+2,3),z(pts+2,3),xx(pts+2,3),yy(pts+2,3)
DIM dx(pts+1,3),dy(pts+1,3),dz(pts+1,3),ang(pts+1,3)
DIM sine(362),cosi(362)
DIM m$(dp+1)

FOR a=0 TO s
sx(a)=-sw/2+RND(sw)
sy(a)=-sh/2+RND(sh)
sz(a)=-500+INT(RND(1000))+.1
NEXT a

FOR a=0 TO dp-1
READ m$(a)
NEXT a

FOR a=0 TO 360
cosi(a)=COS(a*(PI/180))
sine(a)=SIN(a*(PI/180))
NEXT a

FOR b=1 TO 2
FOR a=0 TO pts
ang(a,b)=(360/pts)*a
x(a,b)=(COS(ang(a,b)*(PI/180))*size)
y(a,b)=(SIN(ang(a,b)*(PI/180))*size)
NEXT a
NEXT b
RETURN

DATA 7,"WELCOME","THIS IS"
DATA "COOL RINGS","BY DIGIT"
DATA "DO YOU LIKE THE", "SPINNING RINGS?"
DATA "I THINK THEY ARE COOL!"
Attachments
image.jpg
image.jpg (135.97 KiB) Viewed 1890 times
image.jpg
image.jpg (146.15 KiB) Viewed 1890 times
image.jpg
image.jpg (92.66 KiB) Viewed 1899 times
image.jpg
image.jpg (109.84 KiB) Viewed 1899 times
image.jpg
image.jpg (87.57 KiB) Viewed 1899 times

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

Re: Cool Rings v2 fixed

Post by Dav »

Very well done!

- Dav

User avatar
dE.niz
Posts: 17
Joined: Tue Jan 27, 2015 10:35 am
My devices: Ipad 2 / iphone 4s / macbook / imac .
Location: Belgium
Flag: Belgium

Re: Cool Rings v2 fixed

Post by dE.niz »

really cool ,i like it .

dE.niz

Post Reply