02-19-2023, 09:34 AM
Here is a conversion of a program written by Charlie Veniot.
Are the circles spinning? Not sure? If you wait long enough the program will show you how it is done.
Here is the original: https://basicanywheremachine.neocities.o...s_illusion
Enjoy
J
Are the circles spinning? Not sure? If you wait long enough the program will show you how it is done.
Code:
xmax = 600
ymax = 600
title$ = "Spinning? Yes or No?"
center_x = windowpos_centered
center_y = windowpos_centered
WindowOpen(1,title$,center_x,center_y,xmax,ymax,WindowMode(1,0,0,0,0),1)
SetWindowAutoClose(1, 0)
CanvasOpen(1,xmax,ymax,0,0,xmax,ymax,0)
' Charlie Veniot's BASIC Anywhere Machine mod of the program by B+
' https://basicanywheremachine.neocities.org/sample_programs/BAM_SamplePrograms?page=spinning_dots_illusion
pi = 3.141592654
roundAroundLmt = 3
x0 = xmax / 2
y0 = ymax / 2
a24 = pi * (2 / 24)
r = 240
loopcnt = 0
tinyCircleCnt = 0
do
if loopcnt < roundAroundLmt then
tinyCircleCnt = 11
end if
if loopcnt = roundAroundLmt then
tinyCircleCnt = 0
end if
if loopcnt > roundAroundLmt then
if tinyCircleCnt < 11 then
tinyCircleCnt = tinyCircleCnt + 1
end if
end if
for a = 0 to pi * 2 step pi / 180
setColor(rgb(82, 82, 82))
CircleFill(x0, y0, 251)
for i = 0 to tinyCircleCnt
if loopcnt > roundAroundLmt - 1 then
a24i = a24 * i
xs = x0 + (r * cos(a24i))
ys = y0 + (r * sin(a24i))
xe = x0 + (r * cos(a24i + pi))
ye = y0 + (r * sin(a24i + pi))
setColor(rgb(192, 192, 192))
line(xs, ys, xe, ye)
end if
cv1 = cos(a + (pi * (i/12)))
x = x0 + (cv1 * r * cos(a24 * i))
y = y0 + (cv1 * r * sin(a24 * i))
setColor(rgb(255, 255, 255))
CircleFill(x, y, 10)
next
'wait(4)
if key(27) = 1 then
exit do
end if
update()
next
loopcnt = (loopcnt mod 15) + 1
if Not WindowExists(1) Or WindowEvent_Close(1) Then
end
end if
update()
loop until key(27) = 1
wait 999
Here is the original: https://basicanywheremachine.neocities.o...s_illusion
Enjoy
J
May your journey be free of incident.
Live long and prosper.
Live long and prosper.