Page 1 of 2

2800 circles (iPad)

Posted: Wed Jan 11, 2017 9:30 pm
by Henko
graphics ! xc=380 ! yc=400 ! r=5 ! rho=20
for i=1 to 2800
drho=r*r/rho ! rho+=drho ! a+=.5*drho
fill color .3+rnd(.7),.3+rnd(.7),.3+rnd(.7)
fill circle xc+rho*cos(a),yc+rho*sin(a) size r
next i
end
IMG_1337.PNG
IMG_1337.PNG (1.3 MiB) Viewed 4066 times

Re: 2800 circles (iPad)

Posted: Wed Jan 11, 2017 11:31 pm
by Joel
coool, a new project...
let's see where it's gonna end;-)

Code: Select all

REFRESH OFF
LOOP:
GRAPHICS ! xc=380 ! yc=400 ! r=5 ! rho=20
FOR i=1 TO 2800
drho=r*r/rho ! rho+=drho ! a+=.5*drho
c=RND(3)+1
FILL COLOR 1-ABS(SGN(3-c)),1-ABS(SGN(2-c)), 1-ABS(SGN(1-c))
FILL CIRCLE xc+rho*COS(a),yc+rho*SIN(a) SIZE r
NEXT i
REFRESH
a=0
IF NOT p THEN PAUSE 1 ! p=1
GOTO LOOP

Re: 2800 circles (iPad)

Posted: Thu Jan 12, 2017 12:27 am
by Dav
Nice! great effect for such small code.

- Dav

Re: 2800 circles (iPad)

Posted: Thu Jan 12, 2017 12:51 am
by rbytes
I'm up for that! Joel, I modified your version to take the GRAPHICS command and the constants out of the loop. Only rho needed to be reset in each loop iteration. Should be somewhat faster now. Removed the REFRESH OFF and REFRESH just because I like to watch the waves moving outward from the center. Got rid of the PAUSE because I like maximum speed. My preference for all screen demos is to use the full screen, so added SET TOOLBAR OFF. But then there isn't a stop button, so I included a GET TOUCH routine. It only acts when a FOR-NEXT loop ends.

Code: Select all

' Original by Henko
' Mod by Joel
' Nother mod by rbytes
SET TOOLBAR OFF
GET SCREEN SIZE sw,sh
GRAPHICS ! xc=sw/2 ! yc=sh/2 ! r=5
LOOP:
rho=20
FOR i=1 TO 2800
drho=r*r/rho ! rho+=drho ! a+=.5*drho
c=RND(3)+1
FILL COLOR 1-ABS(SGN(3-c)),1-ABS(SGN(2-c)), 1-ABS(SGN(1-c))
FILL CIRCLE xc+rho*COS(a),yc+rho*SIN(a) SIZE r
NEXT i
a=0
GET TOUCH 0 AS x,y
IF x<>-1 THEN END
GOTO LOOP

Re: 2800 circles (iPad)

Posted: Thu Jan 12, 2017 2:03 am
by Dav
I played with rbytes version a bit, tried to give a 3d look. Just messed it up a little. :D

- Dav

Code: Select all

' Original by Henko
' Mod by Joel
' Nother mod by rbytes
' Messed up by Dav
SET TOOLBAR OFF
GET SCREEN SIZE sw,sh
shadow on
GRAPHICS ! xc=sw/2 ! yc=sh/2 ! r=5
LOOP:
rho=20
v = rnd(200)+25
FOR i=1 TO 2800
drho=r*r/rho ! rho+=drho ! a+=.5*drho
c=RND(3)+1
FILL COLOR 1-ABS(SGN(3-c)),1-ABS(SGN(2-c)), 1-ABS(SGN(1-c))
FILL CIRCLE xc+rho*COS(a),yc+rho*SIN(a) SIZE v/r
NEXT i
a=0
GET TOUCH 0 AS x,y
IF x<>-1 THEN END
GOTO LOOP

Re: 2800 circles (iPad)

Posted: Thu Jan 12, 2017 2:34 am
by Joel
hey dav, cool inspiration, so i played with your version a little bit, and tried to point out the 3d-look, hehe

Code: Select all

' Original by Henko
' Mod by Joel
' Nother mod by rbytes
' Messed up by Dav
SET TOOLBAR OFF
GET SCREEN SIZE sw,sh
SHADOW ON
GRAPHICS ! xc=sw/2 ! yc=sh/2 ! r=5 ! P=1
LOOP:
rho=20
v = RND(200)+25
FOR i=1 TO 2800
d=1*EXP(-1000/(i+500))
'd=1*LOG(1/2800*i)+1
'd=1/2800*i
drho=r*r/rho ! rho+=drho ! a+=.5*drho
c=RND(3)+1
FILL COLOR 1-ABS(SGN(3^p-c))*d,1-ABS(SGN(2^p-c))*d, 1-ABS(SGN(1^p-c))*d
FILL CIRCLE xc+rho*COS(a),yc+rho*SIN(a) SIZE v/r
'FILL CIRCLE xc+rho*COS(a),yc+rho*SIN(a) SIZE r/3*COS(a/2)+r, r/3*SIN(a/2)+r 'en lieu
NEXT i
a=0
GET TOUCH 0 AS x,y
IF x<>-1 THEN 
 IF x<>-1 AND p=0 AND t*TIME()>1 THEN END
 p=0 ! t=1 ! TIME RESET
ENDIF
GOTO LOOP

Re: 2800 circles (iPad)

Posted: Thu Jan 12, 2017 2:42 am
by rbytes
Great 3D effects, Dav and Joel. If only there was a Rosetta category for this. They don't know what they are missing! :lol:

Re: 2800 circles (iPad)

Posted: Thu Jan 12, 2017 2:47 am
by rbytes
OK, I like lots of color. Back to 2D. I used a function to rotate the palette rather than use random colors.
Don't look at this on drugs!

Code: Select all

' Original by Henko
' Mod by Joel
' Rainbow mod by rbytes
SET TOOLBAR OFF
GET SCREEN SIZE sw,sh
GRAPHICS ! xc=sw/2 ! yc=sh/2 ! r=5
LOOP:
rho=20
FOR i=1 TO 2800
t+=.5!IF t>6 THEN t=1
drho=r*r/rho ! rho+=drho ! a+=.5*drho
c=p(t)
p(t)
FILL CIRCLE xc+rho*COS(a),yc+rho*SIN(a) SIZE r
NEXT i
a=0
GET TOUCH 0 AS x,y
IF x<>-1 THEN END
GOTO LOOP

DEF p(c)
  IF c=1 THEN FILL COLOR 1,0,0
  IF c=2 THEN FILL COLOR 1,1,0
  IF c=3 THEN FILL COLOR 0,1,0
  IF c=4 THEN FILL COLOR 0,1,1
  IF c=5 THEN FILL COLOR 0,0,1
  IF c=6 THEN FILL COLOR 1,0,1
END DEF

Re: 2800 circles (iPad)

Posted: Thu Jan 12, 2017 3:11 am
by Dav
nice, rbytes. here's a little "twist".

- Dav

Code: Select all

' Original by Henko
' Mod by Joel
' Rainbow mod by rbytes
SET TOOLBAR OFF
GET SCREEN SIZE sw,sh
GRAPHICS ! xc=sw/2 ! yc=sh/2 ! r=5
LOOP:
rho=20
FOR i=1 TO 2800
t+=.5!IF t>6 THEN t=1
drho=r*r/rho ! rho+=drho ! a+=.5*drho
c=p(t)
p(t)
FILL CIRCLE xc+rho*COS(a),yc+rho*SIN(a) SIZE r
NEXT i
sprite "a"scan 0,0, sw,sh
for y=1 to 255
sprite "a" at 1,1 angle y/255
sprite "a" alpha 100/255 
sprite "a" show
pause .01
next y
a=0
GET TOUCH 0 AS x,y
IF x<>-1 THEN END
GOTO LOOP

DEF p(c)
  IF c=1 THEN FILL COLOR 1,0,0
  IF c=2 THEN FILL COLOR 1,1,0
  IF c=3 THEN FILL COLOR 0,1,0
  IF c=4 THEN FILL COLOR 0,1,1
  IF c=5 THEN FILL COLOR 0,0,1
  IF c=6 THEN FILL COLOR 1,0,1
END DEF

Re: 2800 circles (iPad)

Posted: Thu Jan 12, 2017 3:31 am
by rbytes
We need a whole new Rosetta category called mind-bending graphics, probably with a viewer warning, 8-)