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

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

FellippeHeitor

  • Guest
🎄🎁✨ Holiday Season - are you ready to code?
« on: December 06, 2020, 01:20:53 pm »
🎄☃️ Lights and jingly bells are already all around. It's time to start submitting your 2020 holiday samples! Let's group them under this thread, who'll start? ✨🎁
« Last Edit: December 06, 2020, 01:24:53 pm by FellippeHeitor »

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 #1 on: December 06, 2020, 01:52:31 pm »
Hi Fellippe. I have done 0 rows of the code :). Some conditions, or it is in free style?

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #2 on: December 06, 2020, 02:13:00 pm »
Any requirements?
Shuwatch!

FellippeHeitor

  • Guest
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #3 on: December 06, 2020, 02:28:35 pm »
Make it beautiful, preferably with no extra files.

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #4 on: December 06, 2020, 04:38:14 pm »
Christmas 2020..... I don't think I'm quite up to flaming Xmas trees... :D

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #5 on: December 06, 2020, 08:05:11 pm »
To start decorating you'll need some ornaments, how about ones that rotate color?
Code: QB64: [Select]
  1. _TITLE "Ornaments with Rotating Colors, spacebar to change color set" '  B+ 2018-04-17
  2. 'from figosdev post at http://smallbasic.sourceforge.net/?q=node/1684#comment-1955
  3. 'translating fig to SmallBASIC for alittle cross pollination...
  4. '2020-12-05 for Xmas decorating a little update
  5.  
  6. CONST xmax = 600, ymax = 600
  7. SCREEN _NEWIMAGE(xmax, ymax, 32)
  8. _SCREENMOVE 360, 60
  9. DIM SHARED rrr, ggg, bbb, ccc
  10. cx = 300
  11. ww = 3.14159 / 2 'fix to return back to this after each run
  12. setRGB
  13.     IF INKEY$ = " " THEN setRGB: ccc = 0
  14.     ccc = 0
  15.     w = ww 'fix
  16.     llc = llc + 1
  17.     IF llc = 32000 THEN llc = 0: lc& = 0
  18.     FOR r = 490 TO 300 STEP -.25
  19.         e = w - _PI / 4 / (490 - 300)
  20.         tmp = e: e = w: w = tmp
  21.         FOR p = _PI(-1) TO _PI STEP _PI(1 / 101)
  22.             e = INT((COS(w) * 380) / 2)
  23.             x = INT(COS(p * 2) * e + cx)
  24.             y = INT(SIN(p * 2) * e + r - 50)
  25.             lc& = lc& + 1
  26.             IF lc& MOD 90 = 0 THEN
  27.                 ccc = ccc + .2
  28.                 fcirc x, y, 12, changeRGB~&
  29.             END IF
  30.         NEXT
  31.     NEXT
  32.     _DISPLAY
  33.     _LIMIT 10
  34.  
  35. SUB setRGB 'mod
  36.     rrr = RND ^ 2: ggg = RND ^ 2: bbb = RND ^ 2
  37.  
  38. FUNCTION changeRGB~& 'mod
  39.     changeRGB~& = _RGB32(127 + 127 * SIN(rrr * ccc), 127 + 127 * SIN(ggg * ccc), 127 + 127 * SIN(bbb * ccc))
  40.  
  41. 'from Steve Gold standard
  42. SUB fcirc (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  43.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  44.     DIM X AS INTEGER, Y AS INTEGER
  45.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  46.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  47.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  48.     WHILE X > Y
  49.         RadiusError = RadiusError + Y * 2 + 1
  50.         IF RadiusError >= 0 THEN
  51.             IF X <> Y + 1 THEN
  52.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  53.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  54.             END IF
  55.             X = X - 1
  56.             RadiusError = RadiusError - X * 2
  57.         END IF
  58.         Y = Y + 1
  59.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  60.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  61.     WEND
  62.  
  63.  
  64.  

 
Ornaments with rotating colors.PNG


Looking for Andy's pine tree maker code to put them on.
« Last Edit: December 06, 2020, 08:08:32 pm by bplus »

FellippeHeitor

  • Guest
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #6 on: December 06, 2020, 08:07:46 pm »
Thanks for getting it started, bplus!

Minor typo at line 30: I changed it by adding _DEFAULTCOLOR as the last parameter to fcirc. You may wanna review it.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #7 on: December 06, 2020, 08:09:49 pm »
Was that before I changed it in edit because I posted old version?

I changed changeRGB to a function and the old version had a call to a SUB before the call to old circle routine that didn't take color.

The version I edited should work.
« Last Edit: December 06, 2020, 08:12:09 pm by bplus »

FellippeHeitor

  • Guest
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #8 on: December 06, 2020, 08:11:00 pm »
If there are no bugs in the latest version, then you've fixed it. 😄

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #9 on: December 06, 2020, 08:43:18 pm »
Here is my Merry Christmas 2020 submission. I worked on this all afternoon. :) It has random falling glowing snow (I didn't need help this time! LOL), random hills, and random tiny Christmas Trees. Everything changes every 7 seconds. Enjoy!

Edit: I just added a photo of it.

Code: QB64: [Select]
  1. 'Merry Christmas! From SierraKen
  2. 'Made on December 6, 2020.
  3.  
  4. DIM snowx(2000), snowy(2000)
  5. DIM hills AS LONG
  6. DIM hillx AS SINGLE
  7. DIM shape AS SINGLE
  8.  
  9. _TITLE "Merry Christmas! From SierraKen - Every 7 seconds new mountains and trees appear. Press Esc to quit."
  10. scene = _NEWIMAGE(800, 600, 32)
  11. SCREEN scene
  12. start:
  13. FOR cc = 1 TO 200
  14.     IF cc + 400 > 600 THEN GOTO nex:
  15.     LINE (0, 400 + cc)-(_WIDTH, 400 + cc), _RGB32(0, c + 100, cc)
  16. NEXT cc
  17. nex:
  18. 'Hills
  19. FOR hills = 1 TO 10
  20.     hillx = (RND * _WIDTH)
  21.     sz = (RND * 300)
  22.     shape = (RND + 1)
  23.     c1 = (RND * 155)
  24.     c2 = (RND * 155)
  25.     c3 = (RND * 155)
  26.     FOR size = .2 TO sz STEP .2
  27.         CIRCLE (hillx, 400), size, _RGB32(c1, c2 + size, c3), 2 * _PI, _PI, shape
  28.     NEXT size
  29. NEXT hills
  30. FOR trees = 1 TO 75
  31.     tx = (RND * _WIDTH)
  32.     ty = (RND * 200) + 430
  33.     r = 1
  34.     col = INT(RND * 5) + 1
  35.     IF col = 1 THEN c = _RGB32(255, 0, 0)
  36.     IF col = 2 THEN c = _RGB32(0, 0, 255)
  37.     IF col = 3 THEN c = _RGB32(255, 127, 255)
  38.     IF col = 4 THEN c = _RGB32(127, 255, 255)
  39.     IF col = 5 THEN c = _RGB32(255, 139, 0)
  40.  
  41.     LINE (tx, ty)-(tx + 2, ty - 10), _RGB32(183, 127, 127), BF
  42.  
  43.     LINE (tx, ty - 10)-(tx - 5, ty - 10), _RGB32(127, 255, 127)
  44.     LINE (tx - 5, ty - 10)-(tx, ty - 15), _RGB32(127, 255, 127)
  45.     cx = tx - 5: cy = ty - 10
  46.     fillCircle cx, cy, r, c
  47.     LINE (tx, ty - 15)-(tx - 5, ty - 15), _RGB32(127, 255, 127)
  48.     LINE (tx - 5, ty - 15)-(tx, ty - 20), _RGB32(127, 255, 127)
  49.     cx = tx - 5: cy = ty - 15
  50.     fillCircle cx, cy, r, c
  51.     LINE (tx, ty - 20)-(tx - 5, ty - 20), _RGB32(127, 255, 127)
  52.     LINE (tx - 5, ty - 20)-(tx + 1, ty - 25), _RGB32(127, 255, 127)
  53.     cx = tx - 5: cy = ty - 20
  54.     fillCircle cx, cy, r, c
  55.     LINE (tx + 2, ty - 10)-(tx + 7, ty - 10), _RGB32(127, 255, 127)
  56.     LINE (tx + 7, ty - 10)-(tx + 2, ty - 15), _RGB32(127, 255, 127)
  57.     cx = tx + 7: cy = ty - 10
  58.     fillCircle cx, cy, r, c
  59.     LINE (tx + 2, ty - 15)-(tx + 7, ty - 15), _RGB32(127, 255, 127)
  60.     LINE (tx + 7, ty - 15)-(tx + 2, ty - 20), _RGB32(127, 255, 127)
  61.     cx = tx + 7: cy = ty - 15
  62.     fillCircle cx, cy, r, c
  63.     LINE (tx + 2, ty - 20)-(tx + 7, ty - 20), _RGB32(127, 255, 127)
  64.     LINE (tx + 7, ty - 20)-(tx + 1, ty - 25), _RGB32(127, 255, 127)
  65.     cx = tx + 7: cy = ty - 20
  66.     fillCircle cx, cy, r, c
  67.  
  68.     'Yellow Star
  69.     cx = tx + 1: cy = ty - 26
  70.     r = 1
  71.     c = _RGB32(255, 255, 127)
  72.     fillCircle cx, cy, r, c
  73. NEXT trees
  74.  
  75. hills = _COPYIMAGE(0)
  76.  
  77.     _LIMIT 50
  78.     _PUTIMAGE , hills
  79.     a$ = INKEY$
  80.     IF a$ = CHR$(27) THEN END
  81.     snowing = INT(RND * 1000) + 1
  82.     IF snowing > 900 THEN
  83.         s = s + 1
  84.         IF s > 1500 THEN s = 1
  85.         snowx(s) = (RND * _WIDTH)
  86.         snowy(s) = 0
  87.     END IF
  88.     IF yy > 640 THEN yy = 0
  89.     FOR t = 1 TO 1500
  90.         snowy(t) = snowy(t) + 1
  91.         cx = snowx(t): cy = snowy(t)
  92.         r = RND * 5
  93.         c = _RGB32(255, 255, 255)
  94.         fillCircle cx, cy, r, c
  95.     NEXT t
  96.     _DISPLAY
  97.     CLS
  98.     tim = tim + 1
  99.     IF tim > 500 THEN tim = 0: CLS: _FREEIMAGE hills: GOTO start:
  100.  
  101. 'from Steve Gold standard
  102. SUB fillCircle (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  103.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  104.     DIM X AS INTEGER, Y AS INTEGER
  105.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  106.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  107.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  108.     WHILE X > Y
  109.         RadiusError = RadiusError + Y * 2 + 1
  110.         IF RadiusError >= 0 THEN
  111.             IF X <> Y + 1 THEN
  112.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  113.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  114.             END IF
  115.             X = X - 1
  116.             RadiusError = RadiusError - X * 2
  117.         END IF
  118.         Y = Y + 1
  119.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  120.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  121.     WEND
  122.  
Ken's Christmas Scene 2020.jpg
* Ken's Christmas Scene 2020.jpg (Filesize: 121.25 KB, Dimensions: 798x626, Views: 493)
« Last Edit: December 07, 2020, 12:37:01 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #10 on: December 06, 2020, 08:52:01 pm »
Oh today's the 6th, I like that blinking effect with snowfall Ken.

Found Andy's tree, someone might be able to do something with this?

Code: QB64: [Select]
  1. 'Original IFS fractal by Andy Amaya   copy 2019-12-09
  2. 'ap3-191209-216
  3. _TITLE "IFS Pine Tree"
  4.  
  5. scaleX! = 524.0 '424.0 to 1024.0 look OK for X scaling factor
  6. scaleY! = 524.0
  7. offsetX% = 370
  8. offsetY% = 150
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. CLS , _RGB32(0, 0, 0)
  11. COLOR _RGB32(0, 228, 0, 24)
  12.  
  13. FOR iter& = 0 TO 1000000
  14.         CASE 0 TO .60
  15.             nx! = -0.858985 * lastX! + 0.008944 * lastY! + 0.092336
  16.             ny! = 0.012263 * lastX! + 0.84816 * lastY! + -0.04103
  17.         CASE .60 TO .96
  18.             nx! = -0.373759 * lastX! + -0.353068 * lastY! + 0.296535
  19.             ny! = 0.353068 * lastX! + -0.373759 * lastY! + 0.704598
  20.         CASE ELSE
  21.             nx! = 0.010276 * lastX! + 0 * lastY! + 0.053328
  22.             ny! = -0.05138 * lastX! + 0.313416 * lastY! + 0.576552
  23.     END SELECT
  24.     IF iter& > 20& THEN PSET (nx! * scaleX! + offsetX%, ny! * scaleY! + offsetY%)
  25.     lastX! = nx!
  26.     lastY! = ny!
  27.  

Who me?!
« Last Edit: December 06, 2020, 08:55:08 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #11 on: December 06, 2020, 09:19:43 pm »
Thanks B+ :)

FellippeHeitor

  • Guest
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #12 on: December 07, 2020, 06:13:39 am »
Cool scene, @SierraKen!

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #13 on: December 07, 2020, 11:50:02 am »

FellippeHeitor

  • Guest
Re: 🎄🎁✨ Holiday Season - are you ready to code?
« Reply #14 on: December 07, 2020, 11:53:33 am »
What's more rewarding than having your work featured for the whole community to gasp in awe?