Post by johnno56 on Feb 19, 2023 1:51:20 GMT -6
Here is an interesting "illusion". This is a conversion of a program created by Charlie Veniot using his Basic Anywhere Machine.
The program will show you an image that looks like it is spinning and then it will show you how it is done.
Enjoy.
J
The program will show you an image that looks like it is spinning and then it will show you how it is done.
Enjoy.
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
J