Author |
Topic: Some RISC OS graphical ditties converted to BB4W (Read 623 times) |
|
dfeugey
Guest
|
 |
Re: Some RISC OS graphical ditties converted to BB
« Reply #21 on: Nov 28th, 2015, 12:41pm » |
|
Cool...
|
|
Logged
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: Some RISC OS graphical ditties converted to BB
« Reply #22 on: Nov 28th, 2015, 8:39pm » |
|
on Nov 28th, 2015, 12:41pm, dfeugey wrote:
I think it's time for an ARM BBC BASIC 'mega demo'. Ideally not touching assembly language (in order to keep it purely BASIC). Anyway, if one were to go ahead with it, I think the Raspberry Pi 2 would have to be the minimum requirement (the new Titanium sounds very nice, but I can't afford one!).
Perhaps a future Raspberry Pi 3 will feature an ARM Cortex-A15? That'd be nice, wouldn't it? 
(Someone ought to suggest it to Eben.)
Some new additions to my website: http://www.proggies.uk
I intend to upload my old and more recent BB4W efforts over the next week or two.
David. --
|
|
|
|
dfeugey
Guest
|
 |
Re: Some RISC OS graphical ditties converted to BB
« Reply #23 on: Nov 29th, 2015, 06:47am » |
|
Yep, there is some room for a BBC Basic scene, because of the very fast two offers available (BBCBasic4Win and BBC Basic for RISC OS) and of the presence of interesting computers. On my todo list, I plan to recompile Brandy, with all the latest modifications, and perhaps even CGI management.
|
|
Logged
|
|
|
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
Re: Some RISC OS graphical ditties converted to BB
« Reply #24 on: Dec 4th, 2015, 08:17am » |
|
Hi Folks,
Not really a reply, and not converted from RISC OS, but it seems to fit with the ongoing theme.
Here's a small ditty based on spirograph. Feel free to fiddle with it to your heart's content!
Code:
REM Spirograph simulation (epicycles). A smaller wheel (r2) rolls around inside a bigger one (r1)
MODE 21
ORIGIN 800,600
r1=500 :REM Radius of fixed circle
*REFRESH OFF
FOR denom%=3 TO 10
da2=denom% :REM Angle change in inner wheel between each plotted point, in degrees. You can use it like a speed control
CLS
FOR num%=1 TO denom%-1
r2=r1*num%/denom%
FOR pen=0.1 TO 0.9 STEP 0.01 :REM Distance of pen between centre and edge of smaller wheel
REM CLS:REM If you unREM this line you can see each individual pattern!
IF num% MOD 2=0 THEN p=1-pen ELSE p=pen
PROCDrawIt(0,r1,r2,p,da2,denom%,num%)
*REFRESH
NEXT pen
NEXT num%
NEXT denom%
*REFRESH ON
END
:
DEFPROCDrawIt(startangle,r1,r2,pen,da2,denom%,col%)
LOCAL da1,count%
da1=da2*r2/r1 :REM angle change around fixed circle for each "step" of moving wheel
GCOL col%
count%=0
MOVE (r1-r2)*COSRAD(startangle+da1*count%)+pen*r2*COSRAD(startangle-da2*count%),(r1-r2)*SINRAD(startangle+da1*count%)+pen*r2*SINRAD(startangle-da2*count%)
REPEAT
count%+=1
DRAW (r1-r2)*COSRAD(startangle+da1*count%)+pen*r2*COSRAD(startangle-da2*count%),(r1-r2)*SINRAD(startangle+da1*count%)+pen*r2*SINRAD(startangle-da2*count%)
UNTIL count%*da2>=360*denom%
ENDPROC
Best wishes,
D
|
|
Logged
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: Some RISC OS graphical ditties converted to BB
« Reply #25 on: Dec 4th, 2015, 7:08pm » |
|
Very nice, David.
Here's one inspired by a GIF animation I came across today whilst searching for something related:
http://www.i.imgur.com/Rnk6JvK.gif
(And here's what I was actually looking for: https://upload.wikimedia.org/wikipedia/commons/1/1a/Fourier_series_square_wave_circles_animation.gif)
Code:
REM>CIRCWAVES
REM Idea borrowed from an animated GIF found on Imgur via Reddit.com:
REM http://www.i.imgur.com/Rnk6JvK.gif
REM This BB4W version uses native graphics commands
*FLOAT 64
MODE 8
OFF
COLOUR 1, 64, 64, 64
COLOUR 2, 255, 255, 255
gap% = 2*32
radius% = 2*32
maxX% = (2*@vdu%!208 DIV gap%) + 1
maxY% = (2*@vdu%!212 DIV gap%) + 1
TIME = 0
*REFRESH OFF
REPEAT
CLS
REM Draw the circles first:
GCOL 1
FOR Y% = 0 TO maxY%
cy% = gap%*Y%
FOR X% = 0 TO maxX%
cx% = gap%*X%
CIRCLE cx%, cy%, radius%
NEXT X%
NEXT Y%
REM Now draw the moving points:
GCOL 2
T% = TIME * 2
I% = 0
FOR Y% = 0 TO maxY%
cy% = gap%*Y%
FOR X% = 0 TO maxX%
cx% = gap%*X%
px% = cx% + radius%*COSRAD(T% + I%)
py% = cy% + radius%*SINRAD(T% + I%)
CIRCLE FILL px%, py%, 8
I% += 15
NEXT X%
NEXT Y%
*REFRESH
UNTIL FALSE
EDIT: Which inevitably leads to something like this:
Code:
REM>CIRCWAVES2
*FLOAT 64
MODE 8
OFF
FOR I% = 1 TO 15
COLOUR I%, I%*255/16, I%*255/8, I%*255/4
NEXT I%
gap% = 2*16
radius% = 2*16
maxX% = (2*@vdu%!208 DIV gap%) + 1
maxY% = (2*@vdu%!212 DIV gap%) + 1
arraySz% = maxX% * maxY%
DIM grid%( arraySz%-1, 2 )
TIME = 0
*REFRESH OFF
REPEAT
CLS
I% = 0
T% = TIME
FOR Y% = 0 TO maxY%-1
cy% = gap%*Y%
FOR X% = 0 TO maxX%-1
cx% = gap%*X%
A% = T% + 8*I%
grid%(I%,0) = cx% + radius%*COSRADA%
grid%(I%,1) = cy% + radius%*SINRADA%
grid%(I%,2) = I% MOD 15
I% += 1
NEXT X%
NEXT Y%
FOR Y% = 0 TO maxY%-2
FOR X% = 0 TO maxX%-2
I% = Y%*maxX% + X%
GCOL grid%(I%,2)
MOVE grid%(I%,0), grid%(I%,1)
MOVE grid%(I%+1,0), grid%(I%+1,1)
PLOT 85, grid%(I%+maxX%,0), grid%(I%+maxX%,1)
PLOT 85, grid%(I%+maxX%+1,0), grid%(I%+maxX%+1,1)
NEXT X%
NEXT Y%
*REFRESH
UNTIL FALSE
|
|
|
|
dfeugey
Guest
|
 |
Re: Some RISC OS graphical ditties converted to BB
« Reply #26 on: Dec 7th, 2015, 05:30am » |
|
A full pack of screensavers
|
|
Logged
|
|
|
|
|