Author Topic: 🎄🎁✨ Holiday Season - are you ready to code?  (Read 38160 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #90 on: December 18, 2020, 12:04:06 pm »
Hi @STxAxTIC

I tried your latest and not getting it, maybe need more instruction. By walking forward I assume arrow up key, I do encounter snow that I see and Winter Wonder Land (something like that) in descriptor but see no snowmen or trees I keep going and I seem to end up in space? Some turning left and right required? I did a little of that too, maybe more?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #91 on: December 18, 2020, 12:29:02 pm »
Well I am looking forward to Fellippe's, 2018 Christmas entry was a beauty!

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #92 on: December 18, 2020, 12:39:58 pm »
bplus do you spend any time in 3D simulations of any kind? i can make a video i suppose...

EDIT: I just found a snowman off the terrain, so I definitely have a placement variable wrong. Consider the above a prototype, haha.
« Last Edit: December 18, 2020, 12:54:08 pm by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #93 on: December 19, 2020, 03:50:37 pm »
Well while waiting for STx to fix his, Fellippe, _vince, Ashish? TempodiBasic? I made another one that was going to go into my Christmas Album:

Programmable Tree Lights version 1 (proof of concept):
Code: QB64: [Select]
  1. _TITLE "Programmable Tree Lights, press (&hold) 1, 2, 3 for program" ' b+ 2020-12-19
  2. CONST Xmax = 700, Ymax = 700, NLites = 55, RLite = 30
  3. TYPE LiteSystem
  4.     X AS SINGLE
  5.     Y AS SINGLE
  6.     C AS _UNSIGNED LONG
  7. DIM SHARED L(1 TO NLites) AS LiteSystem
  8. SCREEN _NEWIMAGE(Xmax, Ymax, 32)
  9. _DELAY .25
  10.  
  11. ' Get locations for a pyramid of circles st: ========================================================
  12. 'let n = number of circles at base of pile
  13. n = 10
  14.  
  15. 'let r = radius of each circle
  16. r = RLite
  17.  
  18. 'let base be total length of pile
  19. baseLength = 2 * r * n
  20.  
  21. 'center pyramid in middle of screen
  22. startx = (Xmax - baseLength) / 2
  23.  
  24.  
  25. 'Stringing the lights on tree, adjusted to fit mostly on the tree
  26. 'stacking circles that form equilateral triangles at their origins have a height change of
  27. deltaHeight = r * 3 ^ .5 'r times the sqr(3)
  28. i = 1
  29. FOR row = n TO 1 STEP -1
  30.     IF row = n THEN y = Ymax - r - 1 ELSE y = y - deltaHeight
  31.     FOR col = 1 TO row
  32.         x = startx + col * 2 * r - r
  33.         IF RND < .5 THEN
  34.             r1 = (RND < .45): r2 = (RND < .33): r3 = (RND < .33)
  35.             IF r1 = 0 AND r2 = 0 AND r3 = 0 THEN
  36.                 c~& = _RGB32(100 + RND * 155, 0, RND * 255)
  37.             ELSE
  38.                 c~& = _RGB32(r1 * -(100 + RND * 155), r2 * -(100 + RND * 155), r3 * -(100 + RND * 155))
  39.             END IF
  40.         ELSE
  41.             c~& = _RGB32(100 + RND * 155, 100 + RND * 155, 100 + RND * 155)
  42.         END IF
  43.         L(i).X = x: L(i).Y = y - 3.2 * r - 50: L(i).C = c~&
  44.         i = i + 1
  45.     NEXT
  46.     startx = startx + r
  47.  
  48. ' making the stars
  49. horizon = Ymax - 4 * r
  50. nstars = 100
  51. DIM xstar(100), ystar(100), rstar(100)
  52. FOR i = 1 TO 100
  53.     xstar(i) = RND * (Xmax): ystar(i) = RND * horizon:
  54.     IF i < 75 THEN
  55.         rstar(i) = 0
  56.     ELSEIF i < 95 THEN
  57.         rstar(i) = 1
  58.     ELSE
  59.         rstar(i) = 2
  60.     END IF
  61.  
  62. ' making the background
  63. back = _NEWIMAGE(_WIDTH, _HEIGHT, 32)
  64. FOR i = 0 TO horizon
  65.     LINE (0, i)-(Xmax, i), _RGB32(i / horizon * 70, i / horizon * 22, 60 * (i) / horizon)
  66. land = Ymax - horizon
  67. FOR i = horizon TO Ymax
  68.     cc = 128 + (i - horizon) / land * 127
  69.     LINE (0, i)-(Xmax, i), _RGB32(cc, cc, cc)
  70. FOR i = 1 TO 100
  71.     fcirc xstar(i), ystar(i), rstar(i), &HFFEEEEFF
  72. _PUTIMAGE , 0, back
  73.  
  74. program$ = "1" ' just random
  75. show program$ ' avoid the pause for key checking
  76.     t! = TIMER(.01) '                 needed this for better response to keypresses at such low _LIMIT on loop
  77.     WHILE TIMER(.01) - t! < .25
  78.         k$ = INKEY$
  79.         IF LEN(k$) THEN
  80.             IF INSTR("123", k$) > 0 THEN program$ = k$
  81.             EXIT WHILE
  82.         END IF
  83.         _LIMIT 400
  84.     WEND '                           dang!   still have to hold key down for a while
  85.     _PUTIMAGE , back, 0
  86.     show program$
  87.     _DISPLAY
  88.     _LIMIT 5
  89.  
  90. SUB show (prog$)
  91.     STATIC offset
  92.     Pinetree 25, 30, 650, 600
  93.     SELECT CASE prog$
  94.         CASE "1" 'random blink mostly on
  95.             FOR i = 1 TO NLites
  96.                 IF RND < .8 THEN Lite L(i).X, L(i).Y, L(i).C
  97.             NEXT
  98.         CASE "2" ' random red white and blue
  99.             FOR i = 1 TO NLites
  100.                 r = RND
  101.                 IF r < .33 THEN
  102.                     Lite L(i).X, L(i).Y, &HFFCC0000
  103.                 ELSEIF r < .66 THEN
  104.                     Lite L(i).X, L(i).Y, &HFFFFFFFF
  105.                 ELSE
  106.                     Lite L(i).X, L(i).Y, &HFF0000BB
  107.                 END IF
  108.             NEXT
  109.         CASE "3" ' twinkle
  110.             FOR i = 1 TO NLites
  111.                 fcirc L(i).X, L(i).Y, 2, &HFF00DDFF
  112.                 IF RND < .05 THEN Lite L(i).X, L(i).Y, &HFF00DDFF
  113.             NEXT
  114.     END SELECT
  115.     _TITLE "Program: " + prog$ + "  Programmable Tree Lights, press (&hold) 1, 2, 3 for program"
  116.  
  117. SUB Lite (x, y, c AS _UNSIGNED LONG)
  118.     FOR r = 25 TO 0 STEP -1
  119.         fcirc x, y, r, &H01FFFFFF
  120.     NEXT
  121.     fcirc x, y, 4, c
  122.  
  123. SUB Pinetree (treeX, treeY, wide, high)
  124.     'tannen baum by PeterMaria W  orig 440x460
  125.     'fits here  LINE (0, 0)-(440, 410), , B
  126.     STATIC t&
  127.     IF t& = 0 THEN
  128.         t& = _NEWIMAGE(440, 410, 32)
  129.         _DEST t&
  130.         bpx = 220: bpy = 410
  131.         tpx = bpx
  132.         FOR aa = -4 TO 4
  133.             bpxx = bpx + aa
  134.             bpyy = bpy - 390
  135.             LINE (X + bpxx, y + bpy)-(X + bpx, y + bpyy), _RGB32(30, 30, 0)
  136.         NEXT
  137.         ra = 160
  138.         tpy = bpy - 40
  139.         FOR ht = 1 TO 40
  140.             FOR xs = -100 TO 100 STEP 40
  141.                 xsh = xs / 100
  142.                 rs = RND * 4 / 10
  143.                 tpxx = tpx + (xsh * ra)
  144.                 tpyy = tpy - rs * ra
  145.                 LINE (X + tpx, y + tpy)-(X + tpxx, y + tpyy), _RGB32(50, 40, 20)
  146.                 FOR aa = 1 TO 30
  147.                     fra = RND * 10 / 10 * ra
  148.                     x1 = tpx + (xsh * fra)
  149.                     y1 = tpy - rs * fra
  150.                     x2 = tpx + xsh * (fra + ra / 5)
  151.                     y2 = tpy - rs * fra + (-rs + (RND * 8) / 10 - 0.4) * (ra / 5)
  152.                     LINE (X + x1, y + y1)-(X + x2, y + y2), _RGB32(RND * 80, RND * 70 + 40, RND * 60)
  153.                 NEXT
  154.             NEXT
  155.             ra = ra - 4
  156.             tpy = tpy - 9
  157.         NEXT
  158.         _DEST 0
  159.     END IF
  160.     wf = wide / 440: hf = high / 410
  161.     _PUTIMAGE (treeX, treeY)-STEP(440 * wf, 410 * hf), t&, 0
  162.  
  163. 'from Steve Gold standard
  164. SUB fcirc (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  165.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  166.     DIM X AS INTEGER, Y AS INTEGER
  167.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  168.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  169.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  170.     WHILE X > Y
  171.         RadiusError = RadiusError + Y * 2 + 1
  172.         IF RadiusError >= 0 THEN
  173.             IF X <> Y + 1 THEN
  174.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  175.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  176.             END IF
  177.             X = X - 1
  178.             RadiusError = RadiusError - X * 2
  179.         END IF
  180.         Y = Y + 1
  181.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  182.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  183.     WEND
  184.  
  185.  

Feel free to take this and run with it, a 1000 ways to go from here! :)
« Last Edit: December 19, 2020, 03:54:50 pm by bplus »

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #94 on: December 19, 2020, 06:29:18 pm »
You all are making such great stuff!!  Very impressive.  Works of art, really.

I tried making a good looking Christmas tree in code, but just couldn't.  So I thought I'd share our Christmas tree here at home which I think is special.  Every ornament was handmade by my mom, who is no longer with us. Guess I'm breaking the no external files suggestion, but @FellippeHeitor you did hint at a musical serenade during the zoom meeting, so the attachment is filling that suggestion.

Here's a peek into Christmas around here.  A screensaver of our Christmas tree with some 'Silent Night' background music I quickly recorded today.  You will need the attachment davstree.dat.

- Dav

Code: QB64: [Select]
  1. 'DavsTree.bas
  2. '============
  3. 'Screensaver of my Christmas tree 2020
  4. 'Coded by Dav, DEC/2020, dedicated to my mother.
  5. 'MERRY CHRISTMAS EVERYONE!
  6.  
  7. 'I just wanted to share what Christmas look around here.
  8. 'Here's our tree.  Every ornament was handmade by my mother.
  9. 'I'm improving on 'Silent Night'for the background music.
  10. 'Just having some fun playing, mistakes and all!   - Dav
  11.  
  12. SCREEN _NEWIMAGE(800, 600, 32)
  13.  
  14. 'Start music
  15. b& = _SNDOPEN("davstree.dat"): _SNDPLAY b&
  16.  
  17. FOR f = 1 TO 13
  18.     ShowFrame "davstree.dat", f
  19.  
  20. 'stop music if playing
  21.  
  22.  
  23. :::::::::::::
  24. ::::: END:::: 'Merry Christmas!
  25. :::::::::::::
  26.  
  27. '=============================================================
  28. 'Adapted from my QBV video format...
  29. SUB ShowFrame (file$, framenum)
  30.     FF = FREEFILE
  31.     OPEN file$ FOR BINARY AS FF
  32.     SEEK FF, LOF(FF) - 19
  33.     Ver$ = INPUT$(7, FF) 'Version of QBV video format
  34.     Audio$ = INPUT$(1, FF) 'Audio setting
  35.     vidwidth = CVI(INPUT$(2, FF)) 'Width of video
  36.     vidheight = CVI(INPUT$(2, FF)) 'Height of video
  37.     VidData = CVL(INPUT$(4, FF)) 'Place in file Video data starts
  38.     frames = CVI(INPUT$(2, FF)) 'How many frames in file
  39.     fps = CVI(INPUT$(2, FF)) 'How many fps
  40.     SEEK FF, VidData + 1
  41.     FOR vid = 1 TO frames
  42.         framelen$ = INPUT$(4, FF)
  43.         frame$ = INPUT$(CVL(framelen$), FF)
  44.         IF vid = framenum THEN EXIT FOR
  45.     NEXT
  46.     'make a temp jpg on disk
  47.     FFF = FREEFILE
  48.     OPEN "_tmp_qbv_frame_.jpg" FOR OUTPUT AS FFF
  49.     PRINT #FFF, frame$;
  50.     CLOSE FFF
  51.     'load it
  52.     frm& = _LOADIMAGE("_tmp_qbv_frame_.jpg")
  53.     'erase it
  54.     KILL "_tmp_qbv_frame_.jpg"
  55.  
  56.  
  57.     'fade in from black...
  58.     FOR a = 255 TO 0 STEP -4
  59.         _PUTIMAGE (0, 0), frm&
  60.         LINE (0, 0)-(_WIDTH, _HEIGHT), _RGBA(0, 0, 0, a), BF
  61.         _LIMIT 30
  62.         _DISPLAY
  63.     NEXT
  64.  
  65.     _DELAY 3.9
  66.  
  67.     'fade out to black
  68.     FOR a = 0 TO 255 STEP 4
  69.         _PUTIMAGE (0, 0), frm&
  70.         LINE (0, 0)-(_WIDTH, _HEIGHT), _RGBA(0, 0, 0, a), BF
  71.         _LIMIT 30
  72.         _DISPLAY
  73.     NEXT
  74.  
  75.     _FREEIMAGE frm&
  76.     CLOSE FF
  77.  
  78.  
  79.  

* davstree.dat (Filesize: 1.81 MB, Downloads: 205)
« Last Edit: December 19, 2020, 06:31:53 pm by Dav »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #95 on: December 19, 2020, 06:48:56 pm »
That was really nice, handmade ornaments remind me of Christmas's past. I think my sister took off with the ones I grew up with when she moved to Denver. We had things made from clothespins ( 2 varieties), Popsicle sticks, pine cones, foil, pie tins, tiny photos... Specially valued were 3 old ornaments from Grandma's house one was a small sphere with clock face. She used to host Christmas with 2 sets of families for like 25 years.

Love the music with the story!
« Last Edit: December 19, 2020, 06:51:24 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #96 on: December 19, 2020, 09:15:02 pm »
Here is version #2 of Programmable Tree Lights, new pyramid scheme, 10 color sets, 4 direction modes:
Press digit for color set, letter keys for wave direction h = horizontal, v = vertical, d = diagonal, e = diagonal the other way :)
Code: QB64: [Select]
  1. _TITLE "Programmable Tree Lights v2" ' b+ 2020-12-19
  2. CONST Xmax = 700, Ymax = 700, N_Rows = 10, N_Cols = 2 * N_Rows - 1
  3. CONST X_Spacer = 30, Y_Spacer = 52, X_Offset = 50
  4. TYPE ColorSeed
  5.     Red AS SINGLE
  6.     Green AS SINGLE
  7.     Blue AS SINGLE
  8. DIM SHARED ColorSet(10) AS ColorSeed, ColorSetIndex AS LONG
  9. DIM SHARED pR, pG, pB, pN, pStart, pMode$
  10. DIM SHARED TG(1 TO N_Cols, 1 TO N_Rows) AS LONG
  11. SCREEN _NEWIMAGE(Xmax, Ymax, 32)
  12. _DELAY .25
  13.  
  14. ' setup some color seeds in ColorSet user can change out with Shift + digit key
  15. FOR i = 0 TO 9 ' 10 random color seeds
  16.     resetPlasma
  17.     ColorSet(i).Red = pR: ColorSet(i).Green = pG: ColorSet(i).Blue = pB
  18.  
  19. 'Stringing the lights on tree, adjusted to fit mostly on the tree   2*N - 1 Pryramid
  20. FOR row = 1 TO 10
  21.     l$ = xStr$(2 * row - 1, "X")
  22.     o$ = xStr$(10 - row, "O")
  23.     b$ = o$ + l$ + o$
  24.     FOR Col = 1 TO N_Cols
  25.         IF MID$(b$, Col, 1) = "O" THEN TG(Col, row) = 0 ELSE TG(Col, row) = -1
  26.     NEXT
  27.     PRINT b$
  28.  
  29. ' making the stars
  30. horizon = Ymax - 4 * r
  31. nstars = 100
  32. DIM xstar(100), ystar(100), rstar(100)
  33. FOR i = 1 TO 100
  34.     xstar(i) = RND * (Xmax): ystar(i) = RND * horizon:
  35.     IF i < 75 THEN
  36.         rstar(i) = 0
  37.     ELSEIF i < 95 THEN
  38.         rstar(i) = 1
  39.     ELSE
  40.         rstar(i) = 2
  41.     END IF
  42. ' make a circle tree and align circles to tree with spacers and offsets with new Pyramid Scheme
  43. 'Pinetree 25, 30, 650, 600
  44. 'FOR row = 1 TO N_Rows
  45. '    FOR col = 1 TO N_Cols
  46. '        IF TG(col, row) THEN CIRCLE (col * X_Spacer + X_Offset, row * Y_Spacer), 10
  47. '    NEXT
  48. 'NEXT
  49.  
  50. ' making the background
  51. back = _NEWIMAGE(_WIDTH, _HEIGHT, 32)
  52. horizon = Ymax - 100
  53. FOR i = 0 TO horizon
  54.     LINE (0, i)-(Xmax, i), _RGB32(i / horizon * 70, i / horizon * 22, 60 * (i) / horizon)
  55. land = Ymax - horizon
  56. FOR i = horizon TO Ymax
  57.     cc = 128 + (i - horizon) / land * 127
  58.     LINE (0, i)-(Xmax, i), _RGB32(cc, cc, cc)
  59. FOR i = 1 TO 100
  60.     fcirc xstar(i), ystar(i), rstar(i), &HFFEEEEFF
  61. _PUTIMAGE , 0, back
  62.  
  63. ColorSetIndex = 1: pMode$ = "h"
  64. show ' avoid the pause for key checking
  65.     k$ = INKEY$
  66.     IF LEN(k$) THEN
  67.         IF INSTR("0123456789", k$) > 0 THEN
  68.             ColorSetIndex = VAL(k$)
  69.         ELSEIF INSTR("vhde", k$) > 0 THEN
  70.             pMode$ = k$
  71.         END IF
  72.     END IF
  73.     _PUTIMAGE , back, 0
  74.     show
  75.     _DISPLAY
  76.     _LIMIT 10
  77.  
  78. SUB show
  79.     Pinetree 25, 30, 650, 600
  80.     _TITLE "Programmable Tree Lights (0-9) Color Set: " + TS$(ColorSetIndex) + "  (v, h, d, e) Mode: " + pMode$
  81.     pR = ColorSet(ColorSetIndex).Red: pG = ColorSet(ColorSetIndex).Green: pB = ColorSet(ColorSetIndex).Blue
  82.     pStart = pStart + 1
  83.     SELECT CASE pMode$
  84.         CASE "h"
  85.             FOR row = 1 TO N_Rows
  86.                 pRow = pStart + row
  87.                 FOR col = 1 TO N_Cols
  88.                     pN = pRow
  89.                     IF TG(col, row) THEN Lite col * X_Spacer + X_Offset, row * Y_Spacer, Plasma~&
  90.                 NEXT
  91.             NEXT
  92.         CASE "v"
  93.             FOR row = 1 TO N_Rows
  94.                 FOR col = 1 TO N_Cols
  95.                     pN = pStart + col
  96.                     IF TG(col, row) THEN Lite col * X_Spacer + X_Offset, row * Y_Spacer, Plasma~&
  97.                 NEXT
  98.             NEXT
  99.         CASE "d"
  100.             FOR row = 1 TO N_Rows
  101.                 FOR col = 1 TO N_Cols
  102.                     pN = pStart + col - row
  103.                     IF TG(col, row) THEN Lite col * X_Spacer + X_Offset, row * Y_Spacer, Plasma~&
  104.                 NEXT
  105.             NEXT
  106.         CASE "e"
  107.             FOR row = 1 TO N_Rows
  108.                 FOR col = 1 TO N_Cols
  109.                     pN = pStart + row + col
  110.                     IF TG(col, row) THEN Lite col * X_Spacer + X_Offset, row * Y_Spacer, Plasma~&
  111.                 NEXT
  112.             NEXT
  113.  
  114.     END SELECT
  115.  
  116. SUB Lite (x, y, c AS _UNSIGNED LONG)
  117.     cAnalysis c, cR, cG, cB, cA
  118.     FOR r = 35 TO 0 STEP -2
  119.         fcirc x, y, r, _RGB32(cR, cG, cB, 1)
  120.     NEXT
  121.     fcirc x, y, 4, c
  122.  
  123. SUB Pinetree (treeX, treeY, wide, high)
  124.     'tannen baum by PeterMaria W  orig 440x460
  125.     'fits here  LINE (0, 0)-(440, 410), , B
  126.     STATIC t&
  127.     IF t& = 0 THEN
  128.         t& = _NEWIMAGE(440, 410, 32)
  129.         _DEST t&
  130.         bpx = 220: bpy = 410
  131.         tpx = bpx
  132.         FOR aa = -4 TO 4
  133.             bpxx = bpx + aa
  134.             bpyy = bpy - 390
  135.             LINE (X + bpxx, y + bpy)-(X + bpx, y + bpyy), _RGB32(30, 30, 0)
  136.         NEXT
  137.         ra = 160
  138.         tpy = bpy - 40
  139.         FOR ht = 1 TO 40
  140.             FOR xs = -100 TO 100 STEP 40
  141.                 xsh = xs / 100
  142.                 rs = RND * 4 / 10
  143.                 tpxx = tpx + (xsh * ra)
  144.                 tpyy = tpy - rs * ra
  145.                 LINE (X + tpx, y + tpy)-(X + tpxx, y + tpyy), _RGB32(50, 40, 20)
  146.                 FOR aa = 1 TO 30
  147.                     fra = RND * 10 / 10 * ra
  148.                     x1 = tpx + (xsh * fra)
  149.                     y1 = tpy - rs * fra
  150.                     x2 = tpx + xsh * (fra + ra / 5)
  151.                     y2 = tpy - rs * fra + (-rs + (RND * 8) / 10 - 0.4) * (ra / 5)
  152.                     LINE (X + x1, y + y1)-(X + x2, y + y2), _RGB32(RND * 80, RND * 70 + 40, RND * 60)
  153.                 NEXT
  154.             NEXT
  155.             ra = ra - 4
  156.             tpy = tpy - 9
  157.         NEXT
  158.         _DEST 0
  159.     END IF
  160.     wf = wide / 440: hf = high / 410
  161.     _PUTIMAGE (treeX, treeY)-STEP(440 * wf, 410 * hf), t&, 0
  162.  
  163. SUB cAnalysis (c AS _UNSIGNED LONG, outRed, outGrn, outBlu, outAlp)
  164.     outRed = _RED32(c): outGrn = _GREEN32(c): outBlu = _BLUE32(c): outAlp = _ALPHA32(c)
  165.  
  166. FUNCTION Plasma~& ()
  167.     pN = pN + 1 'dim shared cN as _Integer64, pR as integer, pG as integer, pB as integer
  168.     Plasma~& = _RGB32(127 + 127 * SIN(pR * pN), 127 + 127 * SIN(pG * pN), 127 + 127 * SIN(pB * pN))
  169.  
  170. SUB resetPlasma ()
  171.     pR = RND ^ 2: pG = RND ^ 2: pB = RND ^ 2: pN = 0
  172.  
  173. FUNCTION xStr$ (x, strng$)
  174.     FOR i = 1 TO x
  175.         xStr$ = xStr$ + strng$
  176.     NEXT
  177.  
  178.     TS$ = _TRIM$(STR$(n))
  179.  
  180. 'from Steve Gold standard
  181. SUB fcirc (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  182.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  183.     DIM X AS INTEGER, Y AS INTEGER
  184.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  185.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  186.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  187.     WHILE X > Y
  188.         RadiusError = RadiusError + Y * 2 + 1
  189.         IF RadiusError >= 0 THEN
  190.             IF X <> Y + 1 THEN
  191.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  192.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  193.             END IF
  194.             X = X - 1
  195.             RadiusError = RadiusError - X * 2
  196.         END IF
  197.         Y = Y + 1
  198.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  199.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  200.     WEND
  201.  
  202.  
« Last Edit: December 19, 2020, 09:18:13 pm by bplus »

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #97 on: December 20, 2020, 09:41:54 am »
Thanks, @bplus.  My wife begs me to throw those old ornaments out every year, but it ain't gonna happen. Haven't ran your last post yet, but the code looks interesting...

- Dav

« Last Edit: December 21, 2020, 08:10:27 am by Dav »

FellippeHeitor

  • Guest
Re: %uD83C%uDF84%uD83C%uDF81%u2728 Holiday Season - are you ready to code?
« Reply #98 on: December 20, 2020, 11:24:45 am »
@Dav
That.
Was.
So.
Wholesome.

Man, you rocked that Silent Night! That was amazing! Being able to peek through your X-Mas tree and seeing the hand-made ornaments was so heartwarming.

I thank you so much for sharing that piece. It's wonderful.

@everyone else, I'm still to check your pieces... I'll finally begin having some time off in this holiday season. I'll check your entries soon.

Just to make sure we're all on the same page: is it ok to feature you guys' contributions in a video compilation on our youtube channel?

@Dav is it ok to feature your Silent Night rendition on said video?

PS: I'm running it again and watching the temp files being generated one by one in real time in the background! That's so cool!
« Last Edit: December 20, 2020, 11:27:51 am by FellippeHeitor »

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #99 on: December 20, 2020, 08:53:40 pm »
Dav that was awesome :)

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #100 on: December 21, 2020, 08:02:34 am »
Thanks guys!

@FellippeHeitor: sure, you can use my silent night version on your videos. I wish i had made another recording though, it was a quick 1st take on a cheap keyboard at the last minute, just to add some sound to make it more interesting. Anyway, glad you like it!

Im thinking to expand this idea into a slideshow kit, i have some screen fx and wipes to use.

- Dav

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #101 on: December 21, 2020, 08:13:50 am »
@Dav: Now I've run your program and it's a really beautiful job. Merry Christmas! :)

@FellippeHeitor: I will be honored if you add a video from my program to a video on the Youtube site QB64.
« Last Edit: December 21, 2020, 08:18:26 am by Petr »

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #102 on: December 21, 2020, 09:38:15 am »
Thankyou @Petr. By the way, have you posted the source code of the easy 3d tunnel video you have on your youtube channel? Looks cool!

- Dav

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #103 on: December 21, 2020, 10:32:22 am »
@Dav: This is just an appetizer :) The code will be available as soon as I add the turns.

Offline Adrian

  • Newbie
  • Posts: 39
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #104 on: December 22, 2020, 04:46:51 am »
very cool programs everyone!