Author Topic: Donut with Code Sprinkles looking for Coffee Maker  (Read 6308 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Donut with Code Sprinkles looking for Coffee Maker
« on: March 08, 2018, 08:40:30 pm »
Code: QB64: [Select]
  1. _TITLE "Donut with code sprinkles by bplus 2018-03-08"
  2. CONST xmax = 700
  3. CONST ymax = 700
  4. SCREEN _NEWIMAGE(xmax, ymax, 32)
  5. CONST cx = xmax / 2
  6. CONST cy = ymax / 2
  7. CONST tw = 8
  8. CONST th = 16
  9. OPEN "donut code.bas" FOR INPUT AS #1
  10. WHILE EOF(1) = 0
  11.     LINE INPUT #1, fline$
  12.     f$ = f$ + LTRIM$(fline$) + " : "
  13. f$ = LEFT$(f$, LEN(f$) - 3)
  14. lenF = LEN(f$)
  15. tArea = tw * th * lenF / 2
  16. r = SQR(9 / 4 * tArea / _PI)
  17. FOR y = 0 TO ymax
  18.     FOR x = 0 TO xmax
  19.         d = ((x - cx) ^ 2 + (y - cy) ^ 2) ^ .5
  20.         IF r / 3 < d + 20 AND d - 20 < r THEN
  21.             midInk 180, 90, 55, 80, 40, 20, 1 - ABS(2 / 3 * r - d) / (.335 * r), 0
  22.             PSET (x + 5, y + 10)
  23.         END IF
  24.     NEXT
  25. idx = 0
  26. FOR y = 0 TO ymax STEP th
  27.     FOR x = 0 TO xmax STEP tw
  28.         d = ((x - cx) ^ 2 + (y - cy) ^ 2) ^ .5
  29.         IF r / 3 < d AND d < r THEN
  30.             idx = idx + 1
  31.             midInk 180, 90, 55, 80, 40, 20, ABS(2 / 3 * r - d) / (.335 * r), 1
  32.             IF idx <= lenF THEN this$ = MID$(f$, idx, 1) ELSE this$ = " "
  33.             COLOR , 0   '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EDIT: thanks Fellippe!
  34.             _PRINTSTRING (x, y), this$
  35.         END IF
  36.     NEXT
  37. FUNCTION rand% (lo%, hi%)
  38.     rand% = INT(RND * (hi% - lo% + 1)) + lo%
  39. FUNCTION rclr&&
  40.     rclr&& = _RGB32(rand%(64, 255), rand%(64, 255), rand%(64, 255))
  41. SUB midInk (r1, g1, b1, r2, g2, b2, fr, tf)
  42.     IF tf THEN
  43.         fc&& = rclr&&
  44.     ELSE
  45.         fc&& = _RGB32(r1 + (r2 - r1) * (1 - fr), g1 + (g2 - g1) * (1 - fr), b1 + (b2 - b1) * (1 - fr))
  46.     END IF
  47.     bc&& = _RGB32(r1 + (r2 - r1) * fr, g1 + (g2 - g1) * fr, b1 + (b2 - b1) * fr)
  48.     COLOR fc&&, bc&&
  49. 'XOXOXOXO
  50.  

EDIT: 2018-03-09 as per Fellippe's suggestion in reply below, noted in code and screen shot updated.
EDIT: OK now maybe COLOR , 0 shows up in donut forgot to save before run and screenshot.
Donut with Code Sprinkles.PNG
* Donut with Code Sprinkles.PNG (Filesize: 169.48 KB, Dimensions: 703x726, Views: 365)
« Last Edit: March 09, 2018, 07:35:53 pm by bplus »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #1 on: March 08, 2018, 09:21:22 pm »
WARNING: Do not run B+'s program. Side effects include a "coded " tongue!

Pete :D
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #2 on: March 09, 2018, 09:09:19 am »
WARNING: Do not run B+'s program. Side effects include a "coded " tongue!

Pete :D

Which is why I am looking for coffee maker.   J'ava seen any?

Well maybe STxAxTIC can sprezzo an idea.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #3 on: March 09, 2018, 11:22:24 am »
Bill? Maybe later. He's been off his bean lately.

Until then, have you tried?

Code: QB64: [Select]
  1. SHELL _DONTWAIT "firefox http://javajenius.com/wp-content/uploads/2008/04/hamiltonbeach4cup1.jpg"

Pete :D

PS: The 3-D shading effects you created really make it look like a real donut, which reminds me. You owe me for a new monitor. I dunked mine. :(

 
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

FellippeHeitor

  • Guest
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #4 on: March 09, 2018, 01:28:20 pm »
The idea is so random that it becomes unique. Great faux-3d on this one. Looks yummy!

I added COLOR , 0 right before the _PRINTSTRING statement, because your smooth donut was getting all full of semitransparent rectangles.

PS: Unless you'll _SCREENMOVE _MIDDLE, just let the OS place the window where it wants. Why bother?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #5 on: March 09, 2018, 07:27:29 pm »
The idea is so random that it becomes unique. Great faux-3d on this one. Looks yummy!

I added COLOR , 0 right before the _PRINTSTRING statement, because your smooth donut was getting all full of semitransparent rectangles.

PS: Unless you'll _SCREENMOVE _MIDDLE, just let the OS place the window where it wants. Why bother?

Thanks Fellippe, the COLOR , 0 works great!

I have to move my screens because I keep my tool bar on the left and QB64 never puts screen where I like it.
I have wondered how others find my settings on their screens? (But they can always comment the line out.)

FellippeHeitor

  • Guest
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #6 on: March 09, 2018, 07:53:55 pm »
Quote
QB64 never puts screen where I like it

That's cause QB64 doesn't put it anywhere, it just asks the operating system to create a window. Where it'll show, is the OS's business alone.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #7 on: March 09, 2018, 10:07:41 pm »
Quote
QB64 never puts screen where I like it

That's cause QB64 doesn't put it anywhere, it just asks the operating system to create a window. Where it'll show, is the OS's business alone.

Ah, MS strikes again! "Where it'll show,.."
hmm... It usually shows title bar near middle of screen and typically a good portion goes past the bottom of the screen and the left side overlapping my tool bar.

BTW I edited the Original Post code with Fellippe's suggestion and updated the screen shot with that code change now showing.

Offline codeguy

  • Forum Regular
  • Posts: 174
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #8 on: March 10, 2018, 01:41:18 am »
i WANTED TO SEE THAT DONUT SPIN. My specialized Ellipse/circle rotation algo is PERFECT for this :). Follows the mouse too.
Code: [Select]
'* cgEllipseMapImage
wiley& = _LOADIMAGE("DONUT WITH CODE SPRINKLES.PNG", 32)
h& = _NEWIMAGE(_WIDTH(wiley&), _HEIGHT(wiley&), 32)
SCREEN h&
_SCREENMOVE _MIDDLE
pi# = 3.1415926535897932386#

wwiley% = _WIDTH(wiley&)
hwiley% = _HEIGHT(wiley&)
'* plots to circle if xmag! = ymag!, otherwise an ellipse
xmag! = 1
ymag! = 1
_SOURCE wiley&
_DEST h&
DO
    rot! = rot! + (2 * pi#) / 20
    CLS
    IF wwiley% < hwiley% THEN
        radius% = wwiley% / 2
    ELSE
        radius% = hwiley% / 2
    END IF
    rlimit% = radius% / 4
    gx% = radius% + (wwiley% - radius% * 2)
    gy% = radius% + (hwiley% - radius% * 2)
    DO WHILE _MOUSEINPUT
        offsetx% = _MOUSEX
        offsety% = _MOUSEY
    LOOP
    'offsetx% = xmag! * radius% + (_WIDTH(h&) - 2 * xmag! * radius%)
    'offsety% = ymag! * radius% + (_HEIGHT(h&) - 2 * ymag! * radius%)
    DO
        circloop& = 0
        circ! = 2 * pi# * radius%
        DO
            xscan! = gx% + radius% * COS(2 * pi# * (circloop& / circ!))
            yscan! = gy% + radius% * SIN(2 * pi# * (circloop& / circ!))
            x& = POINT(xscan!, yscan!)

            plotx! = gx% + radius% * COS(rot! + 2 * pi# * (circloop& / circ!))
            ploty! = gy% + radius% * SIN(rot! + 2 * pi# * (circloop& / circ!))

            PSET (offsetx% + (plotx! - gx%) * xmag!, offsety% + (ploty! - gy%) * ymag!), x&
            circloop& = circloop& + 1
        LOOP UNTIL circloop& > circ!
        radius% = radius% - 1
    LOOP UNTIL radius% < rlimit%
    _DISPLAY
    _LIMIT 10
LOOP UNTIL INKEY$ > ""
SCREEN 0
_FREEIMAGE h&
_FREEIMAGE wiley&
SYSTEM
« Last Edit: March 10, 2018, 01:50:11 am by codeguy »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #9 on: March 10, 2018, 03:51:47 pm »
Sorry, we're fresh out of donuts. You didn't include the ping file! I grabbed it from the .net site.

Neat effect. What part of the code makes the two small white streak lines seen just outside the perimeter? I'd nix those. Other than that, wow, that's a lot accomplished for such a small amount of code. t makes me want to png a Ferrari with spinning tires!

Pete :D
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline codeguy

  • Forum Regular
  • Posts: 174
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #10 on: March 10, 2018, 11:55:27 pm »
My guess is that the image is not centered, also that it may be rotating parts of the picture that are not actually the doughnut. There is a colored title bar at the top of this picture. With proper clipping, this artifact would not show up. My code only accounts for images that are centered and borderless. Here's another cool effect using the very same PNG. Again, no OpenGL, just plain old-skool rotations and translations.
Code: QB64: [Select]
  1. '* perspectiverotate.bas
  2. '* a flippin' special by codeguy
  3. '* this version does not use a temporary drawing surface, so it saves memory and perhaps time.
  4. DEFINT A-Z
  5. TYPE Point3d
  6.     x AS INTEGER
  7.     y AS INTEGER
  8.     z AS INTEGER
  9.  
  10. TYPE AccumInteger
  11.     x AS INTEGER
  12.     y AS INTEGER
  13.     z AS INTEGER
  14.  
  15. TYPE CurrentRotations
  16.     rx AS DOUBLE
  17.     ry AS DOUBLE
  18.     rz AS DOUBLE
  19.  
  20. TYPE RotateRec
  21.     SumRotxyz AS CurrentRotations
  22.     AddRotxyz AS CurrentRotations
  23.     Origins AS Point3d
  24.     AddDstXYZ AS AccumInteger
  25.  
  26. TYPE ImageRec
  27.     Filename AS STRING * 32
  28.     handle AS LONG
  29.     starts AS Point3d
  30.     Ends AS Point3d
  31.     scale AS DOUBLE
  32.     intensity AS INTEGER
  33.     transparentcolor AS LONG
  34.     CurrentFrame AS INTEGER
  35.     NumFramesX AS INTEGER
  36.     NumFramesY AS INTEGER
  37.     NumFramesZ AS INTEGER
  38.  
  39. DIM IRec AS ImageRec
  40. IRec.Filename = "donut with code sprinkles.png" '"c:\gaia.jpg" '* "e:\qb64\test.jpg" '*"c:\qb64\v091\qb64\test.jpg" '*
  41. IRec.handle = _LOADIMAGE(Clean$(IRec.Filename), 32)
  42. IRec.Ends.x = _WIDTH(IRec.handle)
  43. IRec.Ends.y = _HEIGHT(IRec.handle)
  44. IRec.Ends.z = _HEIGHT(IRec.handle)
  45. IRec.starts.x = 1
  46. IRec.starts.y = 1
  47. IRec.starts.z = 1
  48. IRec.scale = 1
  49. IRec.intensity = 1
  50. IRec.transparentcolor = _RGB(0, 128, 129)
  51. IRec.CurrentFrame = 0
  52. IRec.NumFramesX = 1
  53. IRec.NumFramesY = 1
  54. IRec.NumFramesZ = 1
  55.  
  56. DIM Scrn AS ImageRec
  57. Scrn.Filename = ":video_output"
  58. Scrn.handle = _SCREENIMAGE
  59. Scrn.Ends.x = _WIDTH(Scrn.handle)
  60. Scrn.Ends.y = _HEIGHT(Scrn.handle)
  61. Scrn.Ends.z = _HEIGHT(Scrn.handle)
  62. Scrn.starts.x = 1
  63. Scrn.starts.y = 1
  64. Scrn.starts.z = 1
  65. Scrn.transparentcolor = -1
  66. Scrn.CurrentFrame = 0
  67. Scrn.NumFramesX = 1
  68. Scrn.NumFramesY = 1
  69. Scrn.NumFramesZ = 1
  70. SCREEN Scrn.handle
  71.  
  72. DIM Rxyz AS RotateRec
  73. Rxyz.AddRotxyz.rx = 3.1415926535 / 17
  74. Rxyz.SumRotxyz.rx = 0
  75. Rxyz.AddRotxyz.ry = 3.1415926535 / 37
  76. Rxyz.SumRotxyz.ry = 0
  77. Rxyz.AddRotxyz.rz = 3.1415926535 / 47
  78. Rxyz.SumRotxyz.rz = 0
  79. Rxyz.Origins.x = _WIDTH(Scrn.handle) / 2
  80. Rxyz.AddDstXYZ.x = 7
  81. Rxyz.Origins.y = _HEIGHT(Scrn.handle) / 2
  82. Rxyz.AddDstXYZ.y = 7
  83. Rxyz.Origins.z = IRec.Ends.z
  84. Rxyz.AddDstXYZ.z = 7
  85.  
  86. CONST holybejeezusthisisgonnabecomplex% = -1
  87. CONST darthwho% = 1
  88. CONST clearscreen% = 0
  89. imageclearmethod% = darthwho%
  90.  
  91. stime# = TIMER(.001)
  92. DIM FrameCount AS _UNSIGNED _BYTE
  93. FrameCount = 0
  94. DIM LastRotateRec AS RotateRec
  95. DIM LastPicRec AS ImageRec
  96. DIM LastScrn AS ImageRec
  97. DIM last
  98.     IF FrameCount < 255 THEN
  99.         FrameCount = FrameCount + 1
  100.     ELSE
  101.         etime# = TIMER(.001)
  102.         _TITLE Clean$(IRec.Filename) + STR$(FrameCount \ (etime# - stime#)) + STR$(FrameCount * IRec.Ends.y * IRec.Ends.x \ (etime# - stime#))
  103.         FrameCount = 0
  104.         stime# = etime#
  105.     END IF
  106.     SELECT CASE imageclearmethod%
  107.         CASE darthwho%
  108.             LINE (Scrn.starts.x, Scrn.starts.y)-(Scrn.Ends.x, Scrn.Ends.y), _RGBA(127, 129, 131, 127), BF '*effect courtesy of darthwho
  109.         CASE holybejeezusthisisgonnabecomplex%
  110.             LastRotateRec = Rxyz
  111.             LastPicRec = IRec
  112.             LastScrn = Scrn
  113.             LastPicRec.intensity = NOT (IRec.intensity) AND 1
  114.             PerspectiveRotate LastPicRec, LastScrn, LastRotateRec.Origins, LastRotateRec.SumRotxyz
  115.         CASE clearscreen%
  116.             CLS
  117.         CASE ELSE
  118.     END SELECT
  119.     PerspectiveRotate IRec, Scrn, Rxyz.Origins, Rxyz.SumRotxyz
  120.     'IRec.intensity = (IRec.intensity + 1) MOD 2
  121.  
  122.     IF IRec.intensity THEN
  123.  
  124.         Rxyz.SumRotxyz.rx = Rxyz.SumRotxyz.rx + Rxyz.AddRotxyz.rx
  125.         IF Rxyz.Origins.x < Scrn.starts.x THEN
  126.             Rxyz.AddDstXYZ.x = -Rxyz.AddDstXYZ.x
  127.         ELSEIF Rxyz.Origins.x > Scrn.Ends.x THEN
  128.             Rxyz.AddDstXYZ.x = -Rxyz.AddDstXYZ.x
  129.         END IF
  130.         Rxyz.Origins.x = Rxyz.Origins.x + Rxyz.AddDstXYZ.x
  131.  
  132.         Rxyz.SumRotxyz.ry = Rxyz.SumRotxyz.ry + Rxyz.AddRotxyz.ry
  133.         IF Rxyz.Origins.y < Scrn.starts.y THEN
  134.             Rxyz.AddDstXYZ.y = -Rxyz.AddDstXYZ.y
  135.         ELSEIF Rxyz.Origins.y > Scrn.Ends.y THEN
  136.             Rxyz.AddDstXYZ.y = -Rxyz.AddDstXYZ.y
  137.         END IF
  138.         Rxyz.Origins.y = Rxyz.Origins.y + Rxyz.AddDstXYZ.y
  139.  
  140.         Rxyz.SumRotxyz.rz = Rxyz.SumRotxyz.rz + Rxyz.AddRotxyz.rz
  141.         IF Rxyz.Origins.z < Scrn.starts.z THEN
  142.             Rxyz.AddDstXYZ.z = -Rxyz.AddDstXYZ.z
  143.         ELSEIF Rxyz.Origins.z > Scrn.Ends.z THEN
  144.             Rxyz.AddDstXYZ.z = -Rxyz.AddDstXYZ.z
  145.         END IF
  146.         Rxyz.Origins.z = Rxyz.Origins.z + Rxyz.AddDstXYZ.z
  147.     END IF
  148.     _DISPLAY
  149. _FREEIMAGE IRec.handle
  150. _FREEIMAGE Scrn.handle
  151.  
  152. SUB PerspectiveRotate (irec AS ImageRec, scrn AS ImageRec, Oxyz AS Point3d, rxyz AS CurrentRotations)
  153.     tdest& = _DEST
  154.     tsource& = _SOURCE
  155.     _SOURCE irec.handle
  156.     _DEST scrn.handle
  157.     srz# = SIN(rxyz.rz)
  158.     zscale! = Oxyz.z / (scrn.Ends.z - scrn.starts.z + 1)
  159.  
  160.     FOR i% = irec.starts.y TO irec.Ends.y
  161.         newx# = (i% * srz#)
  162.         FOR j% = irec.starts.x TO irec.Ends.x
  163.             IF irec.scale = 1 THEN
  164.                 IF irec.intensity THEN
  165.                     p& = POINT(j%, i%)
  166.                     IF p& <> irec.transparentcolor THEN
  167.                         PSET (COS(rxyz.rx) * (newx#) * zscale! + Oxyz.x, SIN(rxyz.rx) * (j% * srz# + i%) * zscale! + Oxyz.y), p&
  168.                     END IF
  169.                 ELSE
  170.                     PSET (COS(rxyz.rx) * (newx#) * zscale! + Oxyz.x, SIN(rxyz.rx) * (j% * srz# + i%) * zscale! + Oxyz.y), 0
  171.                 END IF
  172.             ELSE
  173.                 IF irec.intensity THEN
  174.                     p& = POINT(j%, i%)
  175.                     IF p& <> irec.transparentcolor THEN
  176.                         PSET (COS(rxyz.rx) * (newx# * irec.scale) * zscale! + Oxyz.x, SIN(rxyz.rx) * ((j% * srz# + i%) * irec.scale) * zscale! + Oxyz.y), p&
  177.                     END IF
  178.                 ELSE
  179.                     PSET (COS(rxyz.rx) * (newx# * irec.scale) * zscale! + Oxyz.x, SIN(rxyz.rx) * ((j% * srz# + i%) * irec.scale) * zscale! + Oxyz.y), 0
  180.                 END IF
  181.             END IF
  182.         NEXT
  183.     NEXT
  184.     _SOURCE tsource&
  185.     _DEST tdest&
  186.  
  187. FUNCTION Clean$ (x$) 'sorta like ltrim$(rtrim$(x$))
  188.     a% = 1: b% = LEN(x$)
  189.     DO
  190.         IF a% > b% THEN
  191.             EXIT DO
  192.         ELSE
  193.             IF MID$(x$, a%, 1) > " " THEN
  194.                 IF MID$(x$, b%, 1) > " " THEN
  195.                     EXIT DO
  196.                 ELSE
  197.                     b% = b% - 1
  198.                 END IF
  199.             ELSE
  200.                 a% = a% + 1
  201.             END IF
  202.         END IF
  203.     LOOP
  204.     Clean$ = MID$(x$, a%, b% - a% + 1)
  205.  
« Last Edit: March 10, 2018, 11:57:49 pm by codeguy »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #11 on: March 11, 2018, 12:36:51 am »
My graphics card is not fast enough to appreciate that one. It would make a nice 3-D card dealing effect though.

Pete :)
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline codeguy

  • Forum Regular
  • Posts: 174
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #12 on: March 11, 2018, 04:53:20 am »
It's the size of the image, at 700 * 700, that's a LOT of CPU horsepower. Try a smaller image and it will be fast enough. Maybe the qb64 Bee logo or something 1/2-1/3 the 700 pixel size. Here's one. Cute too :).
evanescence-amy-lee.jpg
* evanescence-amy-lee.jpg (Filesize: 6.91 KB, Dimensions: 114x160, Views: 332)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #13 on: March 11, 2018, 11:02:33 am »
OK does she make coffee?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Donut with Code Sprinkles looking for Coffee Maker
« Reply #14 on: March 11, 2018, 11:30:04 am »
OK a new spin on the donut code:
Code: QB64: [Select]
  1. _TITLE "Donut code spiral by bplus 2018-03-11"
  2. CONST xmax = 700
  3. CONST ymax = 700
  4. SCREEN _NEWIMAGE(xmax, ymax, 32)
  5. CONST cx = xmax / 2
  6. CONST cy = ymax / 2
  7. CONST tw = 8
  8. CONST th = 16
  9. OPEN "donut code spiral.bas" FOR INPUT AS #1
  10. WHILE EOF(1) = 0
  11.     LINE INPUT #1, fline$
  12.     f$ = f$ + LTRIM$(fline$) + " : "
  13. f$ = LEFT$(f$, LEN(f$) - 3)
  14. lenF = LEN(f$)
  15. tArea = tw * th * lenF / 2
  16. r = SQR(9 / 4 * tArea / _PI)
  17. FOR y = 0 TO ymax
  18.     FOR x = 0 TO xmax
  19.         d = ((x - cx) ^ 2 + (y - cy) ^ 2) ^ .5
  20.         IF r / 3 < d + 20 AND d - 20 < r THEN
  21.             midInk 180, 90, 55, 80, 40, 20, 1 - ABS(2 / 3 * r - d) / (.335 * r), 0
  22.             PSET (x + 5, y + 10)
  23.         END IF
  24.     NEXT
  25. idx = 0: rr = r / 3
  26. WHILE idx < lenF
  27.     idx = idx + 1
  28.     rr = r / 3.6 + idx / (rr ^ .4) + 32
  29.     a = a + 12 / rr
  30.     x = cx + rr * COS(a)
  31.     y = cy + rr * SIN(a)
  32.     midInk 180, 90, 55, 80, 40, 20, ABS(2 / 3 * r - d) / (.335 * r), 1
  33.     COLOR , 0
  34.     _PRINTSTRING (x, y), MID$(f$, lenF - idx + 1, 1)
  35. FUNCTION rand% (lo%, hi%)
  36.     rand% = INT(RND * (hi% - lo% + 1)) + lo%
  37. FUNCTION rclr&&
  38.     rclr&& = _RGB32(rand%(64, 255), rand%(64, 255), rand%(64, 255))
  39. SUB midInk (r1, g1, b1, r2, g2, b2, fr, tf)
  40.     IF tf THEN
  41.         fc&& = rclr&&
  42.     ELSE
  43.         fc&& = _RGB32(r1 + (r2 - r1) * (1 - fr), g1 + (g2 - g1) * (1 - fr), b1 + (b2 - b1) * (1 - fr))
  44.     END IF
  45.     bc&& = _RGB32(r1 + (r2 - r1) * fr, g1 + (g2 - g1) * fr, b1 + (b2 - b1) * fr)
  46.     COLOR fc&&, bc&&
  47. 'XOXOXOXO
  48.  

EDIT: oops forgot to change filename, screen shot updated too.
A new Spin on Donut Code.PNG
* A new Spin on Donut Code.PNG (Filesize: 167.84 KB, Dimensions: 700x725, Views: 350)
« Last Edit: March 11, 2018, 11:43:42 am by bplus »