2800 circles (iPad)

Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

2800 circles (iPad)

Post 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 4064 times

Joel
Posts: 57
Joined: Fri Jan 15, 2016 1:36 pm
My devices: miniipad
Flag: Germany

Re: 2800 circles (iPad)

Post 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

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: 2800 circles (iPad)

Post by Dav »

Nice! great effect for such small code.

- Dav

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: 2800 circles (iPad)

Post 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
The only thing that gets me down is gravity...

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: 2800 circles (iPad)

Post 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

Joel
Posts: 57
Joined: Fri Jan 15, 2016 1:36 pm
My devices: miniipad
Flag: Germany

Re: 2800 circles (iPad)

Post 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
Last edited by Joel on Thu Jan 12, 2017 2:45 am, edited 1 time in total.

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: 2800 circles (iPad)

Post 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:
The only thing that gets me down is gravity...

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: 2800 circles (iPad)

Post 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
The only thing that gets me down is gravity...

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: 2800 circles (iPad)

Post 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

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: 2800 circles (iPad)

Post by rbytes »

We need a whole new Rosetta category called mind-bending graphics, probably with a viewer warning, 8-)
The only thing that gets me down is gravity...

Post Reply