• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 Spinning or not? johnno1956 Senior Member    Posts: 466 Threads: 64 Joined: Jun 2021 Reputation: 1 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. 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. Marcus Administrator       Posts: 630 Threads: 82 Joined: Jan 2018 Reputation: 16 03-11-2023, 06:23 AM (This post was last modified: 03-11-2023, 07:59 AM by Marcus.) (02-19-2023, 09:34 AM)johnno1956 Wrote: 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. 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 I think you may have posted the wrong source code in the right forum or the right source code in the wrong forum  johnno1956 Senior Member    Posts: 466 Threads: 64 Joined: Jun 2021 Reputation: 1 03-11-2023, 10:22 AM (This post was last modified: 03-11-2023, 10:48 AM by johnno1956.) Well... THAT was embarrassing!! Wrong source AND wrong forum! That was a conversion that was supposed to go on the RCBasic forum... Obviously my keyboard was in motion before the brain was engaged... *sigh* I had a couple of minutes to spare... Here is the N7 version of the program. Spinning or not? An illusion or not? Code:```visible xmax = 600 visible ymax = 600 set window "Spinning? Yes or No?", xmax, ymax set redraw off ' Charlie Veniot's BASIC Anywhere Machine mod of the program by B+ ' https://basicanywheremachine.neocities.org/sample_programs/BAM_SamplePrograms?page=spinning_dots_illusion visible pi = 3.141592654 visible roundAroundLmt = 3 visible x0 = xmax / 2 visible y0 = ymax / 2 visible a24 = pi * (2 / 24) visible r = 240 visible loopcnt = 0 visible tinyCircleCnt = 0 do     if loopcnt < roundAroundLmt         tinyCircleCnt = 11     endif     if loopcnt = roundAroundLmt         tinyCircleCnt = 0     endif     if loopcnt > roundAroundLmt         if tinyCircleCnt < 11             tinyCircleCnt = tinyCircleCnt + 1         endif     endif     for a = 0 to pi * 2 step pi / 180         set color 82, 82, 82         draw ellipse x0, y0, 251, 251, true         for i = 0 to tinyCircleCnt             if loopcnt > roundAroundLmt - 1                 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))                 set color 192, 192, 192                 draw line xs, ys, xe, ye             endif             cv1 = cos(a + (pi * (i/12)))             x = x0 + (cv1 * r * cos(a24 * i))             y = y0 + (cv1 * r * sin(a24 * i))             set color 255, 255, 255             draw ellipse x, y, 10, 10, true         next         'wait(4)         if keydown(KEY_ESCAPE, true) = 1             wait 999             end         endif         fwait 60         redraw     next     loopcnt = (loopcnt % 15) + 1 until keydown(KEY_ESCAPE, true)``` Enjoy... J May your journey be free of incident. Live long and prosper. Marcus Administrator       Posts: 630 Threads: 82 Joined: Jan 2018 Reputation: 16 03-12-2023, 01:02 PM (03-11-2023, 10:22 AM)johnno1956 Wrote: Well... THAT was embarrassing!! Wrong source AND wrong forum!  That was a conversion that was supposed to go on the RCBasic forum... Obviously my keyboard was in motion before the brain was engaged... *sigh* I had a couple of minutes to spare... Here is the N7 version of the program. Spinning or not? An illusion or not? Code:```visible xmax = 600 visible ymax = 600 set window "Spinning? Yes or No?", xmax, ymax set redraw off ' Charlie Veniot's BASIC Anywhere Machine mod of the program by B+ ' https://basicanywheremachine.neocities.org/sample_programs/BAM_SamplePrograms?page=spinning_dots_illusion visible pi = 3.141592654 visible roundAroundLmt = 3 visible x0 = xmax / 2 visible y0 = ymax / 2 visible a24 = pi * (2 / 24) visible r = 240 visible loopcnt = 0 visible tinyCircleCnt = 0 do     if loopcnt < roundAroundLmt         tinyCircleCnt = 11     endif     if loopcnt = roundAroundLmt         tinyCircleCnt = 0     endif     if loopcnt > roundAroundLmt         if tinyCircleCnt < 11             tinyCircleCnt = tinyCircleCnt + 1         endif     endif     for a = 0 to pi * 2 step pi / 180         set color 82, 82, 82         draw ellipse x0, y0, 251, 251, true         for i = 0 to tinyCircleCnt             if loopcnt > roundAroundLmt - 1                 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))                 set color 192, 192, 192                 draw line xs, ys, xe, ye             endif             cv1 = cos(a + (pi * (i/12)))             x = x0 + (cv1 * r * cos(a24 * i))             y = y0 + (cv1 * r * sin(a24 * i))             set color 255, 255, 255             draw ellipse x, y, 10, 10, true         next         'wait(4)         if keydown(KEY_ESCAPE, true) = 1             wait 999             end         endif         fwait 60         redraw     next     loopcnt = (loopcnt % 15) + 1 until keydown(KEY_ESCAPE, true)``` Enjoy... J WITCHCRAFT! « Next Oldest | Next Newest »

Forum Jump:

Users browsing this thread: 1 Guest(s) 