Author Topic: Halloween Time  (Read 5427 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Halloween Time
« on: October 22, 2019, 03:38:20 pm »
Yep! another clock ;-)) Plus show off Candy Corn color scheme for IDE:
Code: QB64: [Select]
  1. _TITLE "Halloween Time" 'B+ 2019-10-22
  2. CONST m = 350
  3. SCREEN _NEWIMAGE(700, 700, 32)
  4. _SCREENMOVE 500, 10
  5.  
  6. DIM SHARED sprt(15, 15)
  7. FOR y = 0 TO 15
  8.     FOR x = 0 TO 15
  9.         READ sprt(x, y)
  10.     NEXT
  11.  
  12. DIM SHARED sprt2(15, 15)
  13. FOR y = 0 TO 15
  14.     FOR x = 0 TO 15
  15.         READ sprt2(x, y)
  16.     NEXT
  17. DIM SHARED bx, by, bf
  18.  
  19.     CLS
  20.     'angles
  21.     hour% = INT(t# / 3600)
  22.     IF hour% > 12 THEN showHr# = t# / 3600 - 12 ELSE showHr# = t# / 3600
  23.     min# = t# / 60 - hour% * 60
  24.     sec# = t# - hour% * 3600 - INT(min#) * 60
  25.  
  26.     'face
  27.     FOR r = 340 TO 0 STEP -1
  28.         IF r < 150 THEN
  29.             c~& = _RGB32(200 - 50 * r / 100, 150 - 100 * r / 100, 0)
  30.         ELSE
  31.             c~& = _RGB32(200 - 50 * r / 100, 150 - 100 * r / 100, 40 - r / 340)
  32.         END IF
  33.         fcirc m, m, r, c~&
  34.     NEXT
  35.     FOR i = 0 TO 59
  36.         IF i MOD 5 = 0 THEN r = 1 ELSE r = 0
  37.         CIRCLE (350 + 330 * COS(i * _PI(2 / 60)), 350 + 330 * SIN(i * _PI(2 / 60))), r
  38.     NEXT
  39.     'some triangles
  40.     ry~& = _RGBA32(255, 255, 100, RND * 255)
  41.     ftri 290, 335, 305, 365, 335, 350, ry~&
  42.     ftri 410, 335, 395, 365, 365, 350, ry~&
  43.  
  44.     ftri 330, 380, 350, 360, 370, 380, ry~&
  45.  
  46.     ftri 290, 420, 350, 400, 350, 410, ry~&
  47.     ftri 410, 420, 350, 400, 350, 410, ry~&
  48.  
  49.     fcirc m, m, 150, ry~& 'orange glow
  50.  
  51.     'arms and legs
  52.     x = 75 * COS(showHr# * _PI(2 / 12) - _PI / 2)
  53.     y = 75 * SIN(showHr# * _PI(2 / 12) - _PI / 2)
  54.     LINE (m, m)-STEP(x, y), _RGB32(255, 255, 255, 50)
  55.     drawSpinner m + x, m + y, .5, _ATAN2(y, x), &HFF442200
  56.  
  57.     x = 120 * COS(min# * _PI(2 / 60) - _PI / 2)
  58.     y = 120 * SIN(min# * _PI(2 / 60) - _PI / 2)
  59.     LINE (m, m)-STEP(x, y), _RGB32(255, 255, 255, 50)
  60.     drawSpinner m + x, m + y, .3, _ATAN2(y, x), &HFF442211
  61.  
  62.     'seconds fly by...
  63.     bx = 350 + 290 * COS(sec# * _PI(2 / 60) - _PI / 2)
  64.     by = 350 + 290 * SIN(sec# * _PI(2 / 60) - _PI / 2)
  65.     drawb
  66.  
  67.  
  68.     _DISPLAY
  69.     _LIMIT 5 '<<<< works pretty good!
  70.     t# = TIMER
  71.  
  72. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  73. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  74. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  75. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  76. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  77. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  78. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  79. DATA 0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0
  80. DATA 1,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0
  81. DATA 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0
  82. DATA 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0
  83. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  84. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  85. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  86. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  87. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  88.  
  89. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  90. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  91. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  92. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  93. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  94. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  95. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  96. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  97. DATA 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0
  98. DATA 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0
  99. DATA 0,0,0,0,1,0,1,1,1,0,0,1,0,0,0,0
  100. DATA 0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0
  101. DATA 0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0
  102. DATA 0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0
  103. DATA 0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0
  104. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  105.  
  106. SUB drawb
  107.     bf = (bf + 1) MOD 5
  108.     sz = 3
  109.     IF bf = 0 THEN
  110.         FOR y = 0 TO 15
  111.             FOR x = 0 TO 15
  112.                 IF sprt2(x, y) THEN LINE (x * sz + bx - 7.5 * sz, .5 * y * sz + by - 7.5 * sz)-STEP(sz, sz), _RGB32(0, 0, 0), BF
  113.             NEXT
  114.         NEXT
  115.     ELSE
  116.         FOR y = 0 TO 15
  117.             FOR x = 0 TO 15
  118.                 IF sprt(x, y) THEN LINE (x * sz + bx - 7.5 * sz, y * sz + by - 7.5 * sz)-STEP(sz, sz), _RGB32(0, 0, 0), BF
  119.             NEXT
  120.         NEXT
  121.     END IF
  122.  
  123. SUB drawSpinner (x AS INTEGER, y AS INTEGER, scale AS SINGLE, heading AS SINGLE, c AS _UNSIGNED LONG)
  124.     DIM x1, x2, x3, x4, y1, y2, y3, y4, r, a, a1, a2, lg, d, rd, red, blue, green
  125.     STATIC switch AS INTEGER
  126.     switch = switch + 2
  127.     switch = switch MOD 16 + 1
  128.     red = _RED32(c): green = _GREEN32(c): blue = _BLUE32(c)
  129.     r = 10 * scale
  130.     x1 = x + r * COS(heading): y1 = y + r * SIN(heading)
  131.     r = 2 * r 'lg lengths
  132.     FOR lg = 1 TO 8
  133.         IF lg < 5 THEN
  134.             a = heading + .9 * lg * _PI(1 / 5) + (lg = switch) * _PI(1 / 10)
  135.         ELSE
  136.             a = heading - .9 * (lg - 4) * _PI(1 / 5) - (lg = switch) * _PI(1 / 10)
  137.         END IF
  138.         x2 = x1 + r * COS(a): y2 = y1 + r * SIN(a)
  139.         drawLink x1, y1, 3 * scale, x2, y2, 2 * scale, _RGB32(red + 20, green + 10, blue + 5)
  140.         IF lg = 1 OR lg = 2 OR lg = 7 OR lg = 8 THEN d = -1 ELSE d = 1
  141.         a1 = a + d * _PI(1 / 12)
  142.         x3 = x2 + r * 1.5 * COS(a1): y3 = y2 + r * 1.5 * SIN(a1)
  143.         drawLink x2, y2, 2 * scale, x3, y3, scale, _RGB32(red + 35, green + 17, blue + 8)
  144.         rd = INT(RND * 8) + 1
  145.         a2 = a1 + d * _PI(1 / 8) * rd / 8
  146.         x4 = x3 + r * 1.5 * COS(a2): y4 = y3 + r * 1.5 * SIN(a2)
  147.         drawLink x3, y3, scale, x4, y4, scale, _RGB32(red + 50, green + 25, blue + 12)
  148.     NEXT
  149.     r = r * .5
  150.     fcirc x1, y1, r, _RGB32(red - 20, green - 10, blue - 5)
  151.     x2 = x1 + (r + 1) * COS(heading - _PI(1 / 12)): y2 = y1 + (r + 1) * SIN(heading - _PI(1 / 12))
  152.     fcirc x2, y2, r * .2, &HFF000000
  153.     x2 = x1 + (r + 1) * COS(heading + _PI(1 / 12)): y2 = y1 + (r + 1) * SIN(heading + _PI(1 / 12))
  154.     fcirc x2, y2, r * .2, &HFF000000
  155.     r = r * 2
  156.     x1 = x + r * .9 * COS(heading + _PI): y1 = y + r * .9 * SIN(heading + _PI)
  157.     TiltedEllipseFill 0, x1, y1, r, .7 * r, heading + _PI, _RGB32(red, green, blue)
  158.  
  159. SUB drawLink (x1, y1, r1, x2, y2, r2, c AS _UNSIGNED LONG)
  160.     DIM a, a1, a2, x3, x4, x5, x6, y3, y4, y5, y6
  161.     a = _ATAN2(y2 - y1, x2 - x1)
  162.     a1 = a + _PI(1 / 2)
  163.     a2 = a - _PI(1 / 2)
  164.     x3 = x1 + r1 * COS(a1): y3 = y1 + r1 * SIN(a1)
  165.     x4 = x1 + r1 * COS(a2): y4 = y1 + r1 * SIN(a2)
  166.     x5 = x2 + r2 * COS(a1): y5 = y2 + r2 * SIN(a1)
  167.     x6 = x2 + r2 * COS(a2): y6 = y2 + r2 * SIN(a2)
  168.     fquad x3, y3, x4, y4, x5, y5, x6, y6, c
  169.     fcirc x1, y1, r1, c
  170.     fcirc x2, y2, r2, c
  171.  
  172. 'need 4 non linear points (not all on 1 line) list them clockwise so x2, y2 is opposite of x4, y4
  173. SUB fquad (x1 AS INTEGER, y1 AS INTEGER, x2 AS INTEGER, y2 AS INTEGER, x3 AS INTEGER, y3 AS INTEGER, x4 AS INTEGER, y4 AS INTEGER, c AS _UNSIGNED LONG)
  174.     ftri x1, y1, x2, y2, x4, y4, c
  175.     ftri x3, y3, x4, y4, x1, y1, c
  176.  
  177. SUB ftri (x1, y1, x2, y2, x3, y3, K AS _UNSIGNED LONG)
  178.     DIM a&
  179.     a& = _NEWIMAGE(1, 1, 32)
  180.     _DEST a&
  181.     PSET (0, 0), K
  182.     _DEST 0
  183.     _MAPTRIANGLE _SEAMLESS(0, 0)-(0, 0)-(0, 0), a& TO(x1, y1)-(x2, y2)-(x3, y3)
  184.     _FREEIMAGE a& '<<< this is important!
  185.  
  186. SUB fcirc (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  187.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  188.     DIM X AS INTEGER, Y AS INTEGER
  189.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  190.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  191.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  192.     WHILE X > Y
  193.         RadiusError = RadiusError + Y * 2 + 1
  194.         IF RadiusError >= 0 THEN
  195.             IF X <> Y + 1 THEN
  196.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  197.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  198.             END IF
  199.             X = X - 1
  200.             RadiusError = RadiusError - X * 2
  201.         END IF
  202.         Y = Y + 1
  203.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  204.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  205.     WEND
  206.  
  207. SUB TiltedEllipseFill (destHandle&, x0, y0, a, b, ang, c AS _UNSIGNED LONG)
  208.     DIM max AS INTEGER, mx2 AS INTEGER, i AS INTEGER, j AS INTEGER, k AS SINGLE, lasti AS SINGLE, lastj AS SINGLE
  209.     DIM prc AS _UNSIGNED LONG, tef AS LONG
  210.     prc = _RGB32(255, 255, 255, 255)
  211.     IF a > b THEN max = a + 1 ELSE max = b + 1
  212.     mx2 = max + max
  213.     tef = _NEWIMAGE(mx2, mx2)
  214.     _DEST tef
  215.     _SOURCE tef 'point wont read without this!
  216.     FOR k = 0 TO 6.2832 + .05 STEP .1
  217.         i = max + a * COS(k) * COS(ang) + b * SIN(k) * SIN(ang)
  218.         j = max + a * COS(k) * SIN(ang) - b * SIN(k) * COS(ang)
  219.         IF k <> 0 THEN
  220.             LINE (lasti, lastj)-(i, j), prc
  221.         ELSE
  222.             PSET (i, j), prc
  223.         END IF
  224.         lasti = i: lastj = j
  225.     NEXT
  226.     DIM xleft(mx2) AS INTEGER, xright(mx2) AS INTEGER, x AS INTEGER, y AS INTEGER
  227.     FOR y = 0 TO mx2
  228.         x = 0
  229.         WHILE POINT(x, y) <> prc AND x < mx2
  230.             x = x + 1
  231.         WEND
  232.         xleft(y) = x
  233.         WHILE POINT(x, y) = prc AND x < mx2
  234.             x = x + 1
  235.         WEND
  236.         WHILE POINT(x, y) <> prc AND x < mx2
  237.             x = x + 1
  238.         WEND
  239.         IF x = mx2 THEN xright(y) = xleft(y) ELSE xright(y) = x
  240.     NEXT
  241.     _DEST destHandle&
  242.     FOR y = 0 TO mx2
  243.         IF xleft(y) <> mx2 THEN LINE (xleft(y) + x0 - max, y + y0 - max)-(xright(y) + x0 - max, y + y0 - max), c, BF
  244.     NEXT
  245.     _FREEIMAGE tef
  246.  
  247.  
Halloween Time.PNG
« Last Edit: October 22, 2019, 03:42:59 pm by bplus »

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Halloween Time
« Reply #1 on: October 22, 2019, 03:51:04 pm »
Yep Great,
I can run it as screensaver!
Programming isn't difficult, only it's  consuming time and coffee

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Halloween Time
« Reply #2 on: October 22, 2019, 05:31:45 pm »
Halloween is trying to take off here in Australia. I think the kids like it as a new source of sugar... I'm sure the merchandise trade likes it too... I not a fan... But I did like the clock!! Very cool... Oh... Can we pre-book clocks for Easter and Christmas? Hmm... Can we?

If you like Halloween then you may want to get hold of a 1963 recording, "Wes Harrison - You won't believe your ears."
He does vocal sound effects and has a brilliant track all about Halloween... Very funny! (... and no obscenities ...)

Don't forget. Looking forward to Xmas and Easter! Nudge, nudge, wink, wink. Say no more. (Don't you just love Monty Python?!)
Logic is the beginning of wisdom.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Halloween Time
« Reply #3 on: October 22, 2019, 09:56:30 pm »
Woah that's very original looking! Great job! Works well too and good artistry.

I will be handing out candy for a few hours at the Museum this year like I try to do every year. I ordered me a Jedi Knight robe and a light saber. :) I think I will be Obi-wan-KEN-obi. :)


Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Halloween Time
« Reply #4 on: October 23, 2019, 10:25:18 am »
Wow B+! It took me a minute to notice it is a clock. Creative!
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Halloween Time
« Reply #5 on: October 23, 2019, 01:01:53 pm »
Thanks all! Johnno, I checked out Wes Harrison last night, very talented sound maker and comedian.

I removed the Blink'n Blinking for a calmer clock, and redid lines so outer one doesn't draw on top of inner Spider when they are close:
Code: QB64: [Select]
  1. _TITLE "Halloween Time" 'B+ 2019-10-22
  2. ' 2019-10-23 attempt to change transparency gradually to loose blinking
  3.  
  4. CONST m = 350
  5. SCREEN _NEWIMAGE(700, 700, 32)
  6. _SCREENMOVE 500, 10
  7.  
  8. DIM SHARED sprt(15, 15)
  9. FOR y = 0 TO 15
  10.     FOR x = 0 TO 15
  11.         READ sprt(x, y)
  12.     NEXT
  13.  
  14. DIM SHARED sprt2(15, 15)
  15. FOR y = 0 TO 15
  16.     FOR x = 0 TO 15
  17.         READ sprt2(x, y)
  18.     NEXT
  19. DIM SHARED bx, by, bf
  20. dt = 1
  21.     CLS
  22.  
  23.     'angles
  24.     hour% = INT(t# / 3600)
  25.     IF hour% > 12 THEN showHr# = t# / 3600 - 12 ELSE showHr# = t# / 3600
  26.     min# = t# / 60 - hour% * 60
  27.     sec# = t# - hour% * 3600 - INT(min#) * 60
  28.  
  29.     'face
  30.     FOR r = 340 TO 0 STEP -1
  31.         IF r < 150 THEN
  32.             c~& = _RGB32(200 - 50 * r / 100, 150 - 100 * r / 100, 0)
  33.         ELSE
  34.             c~& = _RGB32(200 - 50 * r / 100, 150 - 100 * r / 100, 40 - r / 340)
  35.         END IF
  36.         fcirc m, m, r, c~&
  37.     NEXT
  38.     FOR i = 0 TO 59
  39.         IF i MOD 5 = 0 THEN r = 1 ELSE r = 0
  40.         CIRCLE (350 + 330 * COS(i * _PI(2 / 60)), 350 + 330 * SIN(i * _PI(2 / 60))), r
  41.     NEXT
  42.     'some triangles
  43.     t = t + dt
  44.     IF t > 180 THEN dt = -dt: t = 180
  45.     IF t < 1 THEN dt = -dt: t = 1
  46.     ry~& = _RGBA32(255, 255, 100, t)
  47.     ftri 290, 335, 305, 365, 335, 350, ry~&
  48.     ftri 410, 335, 395, 365, 365, 350, ry~&
  49.     ftri 330, 380, 350, 360, 370, 380, ry~&
  50.     ftri 290, 420, 350, 400, 350, 410, ry~&
  51.     ftri 410, 420, 350, 400, 350, 410, ry~&
  52.     fcirc m, m, 150, ry~& 'more orange glow
  53.  
  54.     'arms and legs
  55.     x1 = 75 * COS(showHr# * _PI(2 / 12) - _PI / 2)
  56.     y1 = 75 * SIN(showHr# * _PI(2 / 12) - _PI / 2)
  57.     x2 = 120 * COS(min# * _PI(2 / 60) - _PI / 2)
  58.     y2 = 120 * SIN(min# * _PI(2 / 60) - _PI / 2)
  59.     LINE (m, m)-STEP(x1, y1), _RGB32(255, 255, 255, 50)
  60.     LINE (m, m)-STEP(x2, y2), _RGB32(255, 255, 255, 50)
  61.     drawSpinner m + x1, m + y1, .5, _ATAN2(y1, x1), &HFF442200
  62.     drawSpinner m + x2, m + y2, .3, _ATAN2(y2, x2), &HFF442211
  63.  
  64.     'seconds fly by...
  65.     bx = 350 + 290 * COS(sec# * _PI(2 / 60) - _PI / 2)
  66.     by = 350 + 290 * SIN(sec# * _PI(2 / 60) - _PI / 2)
  67.     drawb
  68.  
  69.     _DISPLAY
  70.     _LIMIT 5
  71.     t# = TIMER
  72.  
  73. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  74. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  75. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  76. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  77. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  78. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  79. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  80. DATA 0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0
  81. DATA 1,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0
  82. DATA 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0
  83. DATA 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0
  84. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  85. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  86. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  87. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  88. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  89.  
  90. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  91. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  92. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  93. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  94. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  95. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  96. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  97. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  98. DATA 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0
  99. DATA 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0
  100. DATA 0,0,0,0,1,0,1,1,1,0,0,1,0,0,0,0
  101. DATA 0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0
  102. DATA 0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0
  103. DATA 0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0
  104. DATA 0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0
  105. DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  106.  
  107. SUB drawb
  108.     bf = (bf + 1) MOD 5
  109.     sz = 3
  110.     IF bf = 0 THEN
  111.         FOR y = 0 TO 15
  112.             FOR x = 0 TO 15
  113.                 IF sprt2(x, y) THEN LINE (x * sz + bx - 7.5 * sz, .5 * y * sz + by - 7.5 * sz)-STEP(sz, sz), _RGB32(0, 0, 0), BF
  114.             NEXT
  115.         NEXT
  116.     ELSE
  117.         FOR y = 0 TO 15
  118.             FOR x = 0 TO 15
  119.                 IF sprt(x, y) THEN LINE (x * sz + bx - 7.5 * sz, y * sz + by - 7.5 * sz)-STEP(sz, sz), _RGB32(0, 0, 0), BF
  120.             NEXT
  121.         NEXT
  122.     END IF
  123.  
  124. SUB drawSpinner (x AS INTEGER, y AS INTEGER, scale AS SINGLE, heading AS SINGLE, c AS _UNSIGNED LONG)
  125.     DIM x1, x2, x3, x4, y1, y2, y3, y4, r, a, a1, a2, lg, d, rd, red, blue, green
  126.     STATIC switch AS INTEGER
  127.     switch = switch + 2
  128.     switch = switch MOD 16 + 1
  129.     red = _RED32(c): green = _GREEN32(c): blue = _BLUE32(c)
  130.     r = 10 * scale
  131.     x1 = x + r * COS(heading): y1 = y + r * SIN(heading)
  132.     r = 2 * r 'lg lengths
  133.     FOR lg = 1 TO 8
  134.         IF lg < 5 THEN
  135.             a = heading + .9 * lg * _PI(1 / 5) + (lg = switch) * _PI(1 / 10)
  136.         ELSE
  137.             a = heading - .9 * (lg - 4) * _PI(1 / 5) - (lg = switch) * _PI(1 / 10)
  138.         END IF
  139.         x2 = x1 + r * COS(a): y2 = y1 + r * SIN(a)
  140.         drawLink x1, y1, 3 * scale, x2, y2, 2 * scale, _RGB32(red + 20, green + 10, blue + 5)
  141.         IF lg = 1 OR lg = 2 OR lg = 7 OR lg = 8 THEN d = -1 ELSE d = 1
  142.         a1 = a + d * _PI(1 / 12)
  143.         x3 = x2 + r * 1.5 * COS(a1): y3 = y2 + r * 1.5 * SIN(a1)
  144.         drawLink x2, y2, 2 * scale, x3, y3, scale, _RGB32(red + 35, green + 17, blue + 8)
  145.         rd = INT(RND * 8) + 1
  146.         a2 = a1 + d * _PI(1 / 8) * rd / 8
  147.         x4 = x3 + r * 1.5 * COS(a2): y4 = y3 + r * 1.5 * SIN(a2)
  148.         drawLink x3, y3, scale, x4, y4, scale, _RGB32(red + 50, green + 25, blue + 12)
  149.     NEXT
  150.     r = r * .5
  151.     fcirc x1, y1, r, _RGB32(red - 20, green - 10, blue - 5)
  152.     x2 = x1 + (r + 1) * COS(heading - _PI(1 / 12)): y2 = y1 + (r + 1) * SIN(heading - _PI(1 / 12))
  153.     fcirc x2, y2, r * .2, &HFF000000
  154.     x2 = x1 + (r + 1) * COS(heading + _PI(1 / 12)): y2 = y1 + (r + 1) * SIN(heading + _PI(1 / 12))
  155.     fcirc x2, y2, r * .2, &HFF000000
  156.     r = r * 2
  157.     x1 = x + r * .9 * COS(heading + _PI): y1 = y + r * .9 * SIN(heading + _PI)
  158.     TiltedEllipseFill 0, x1, y1, r, .7 * r, heading + _PI, _RGB32(red, green, blue)
  159.  
  160. SUB drawLink (x1, y1, r1, x2, y2, r2, c AS _UNSIGNED LONG)
  161.     DIM a, a1, a2, x3, x4, x5, x6, y3, y4, y5, y6
  162.     a = _ATAN2(y2 - y1, x2 - x1)
  163.     a1 = a + _PI(1 / 2)
  164.     a2 = a - _PI(1 / 2)
  165.     x3 = x1 + r1 * COS(a1): y3 = y1 + r1 * SIN(a1)
  166.     x4 = x1 + r1 * COS(a2): y4 = y1 + r1 * SIN(a2)
  167.     x5 = x2 + r2 * COS(a1): y5 = y2 + r2 * SIN(a1)
  168.     x6 = x2 + r2 * COS(a2): y6 = y2 + r2 * SIN(a2)
  169.     fquad x3, y3, x4, y4, x5, y5, x6, y6, c
  170.     fcirc x1, y1, r1, c
  171.     fcirc x2, y2, r2, c
  172.  
  173. 'need 4 non linear points (not all on 1 line) list them clockwise so x2, y2 is opposite of x4, y4
  174. SUB fquad (x1 AS INTEGER, y1 AS INTEGER, x2 AS INTEGER, y2 AS INTEGER, x3 AS INTEGER, y3 AS INTEGER, x4 AS INTEGER, y4 AS INTEGER, c AS _UNSIGNED LONG)
  175.     ftri x1, y1, x2, y2, x4, y4, c
  176.     ftri x3, y3, x4, y4, x1, y1, c
  177.  
  178. SUB ftri (x1, y1, x2, y2, x3, y3, K AS _UNSIGNED LONG)
  179.     DIM a&
  180.     a& = _NEWIMAGE(1, 1, 32)
  181.     _DEST a&
  182.     PSET (0, 0), K
  183.     _DEST 0
  184.     _MAPTRIANGLE _SEAMLESS(0, 0)-(0, 0)-(0, 0), a& TO(x1, y1)-(x2, y2)-(x3, y3)
  185.     _FREEIMAGE a& '<<< this is important!
  186.  
  187. SUB fcirc (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  188.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  189.     DIM X AS INTEGER, Y AS INTEGER
  190.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  191.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  192.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  193.     WHILE X > Y
  194.         RadiusError = RadiusError + Y * 2 + 1
  195.         IF RadiusError >= 0 THEN
  196.             IF X <> Y + 1 THEN
  197.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  198.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  199.             END IF
  200.             X = X - 1
  201.             RadiusError = RadiusError - X * 2
  202.         END IF
  203.         Y = Y + 1
  204.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  205.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  206.     WEND
  207.  
  208. SUB TiltedEllipseFill (destHandle&, x0, y0, a, b, ang, c AS _UNSIGNED LONG)
  209.     DIM max AS INTEGER, mx2 AS INTEGER, i AS INTEGER, j AS INTEGER, k AS SINGLE, lasti AS SINGLE, lastj AS SINGLE
  210.     DIM prc AS _UNSIGNED LONG, tef AS LONG
  211.     prc = _RGB32(255, 255, 255, 255)
  212.     IF a > b THEN max = a + 1 ELSE max = b + 1
  213.     mx2 = max + max
  214.     tef = _NEWIMAGE(mx2, mx2)
  215.     _DEST tef
  216.     _SOURCE tef 'point wont read without this!
  217.     FOR k = 0 TO 6.2832 + .05 STEP .1
  218.         i = max + a * COS(k) * COS(ang) + b * SIN(k) * SIN(ang)
  219.         j = max + a * COS(k) * SIN(ang) - b * SIN(k) * COS(ang)
  220.         IF k <> 0 THEN
  221.             LINE (lasti, lastj)-(i, j), prc
  222.         ELSE
  223.             PSET (i, j), prc
  224.         END IF
  225.         lasti = i: lastj = j
  226.     NEXT
  227.     DIM xleft(mx2) AS INTEGER, xright(mx2) AS INTEGER, x AS INTEGER, y AS INTEGER
  228.     FOR y = 0 TO mx2
  229.         x = 0
  230.         WHILE POINT(x, y) <> prc AND x < mx2
  231.             x = x + 1
  232.         WEND
  233.         xleft(y) = x
  234.         WHILE POINT(x, y) = prc AND x < mx2
  235.             x = x + 1
  236.         WEND
  237.         WHILE POINT(x, y) <> prc AND x < mx2
  238.             x = x + 1
  239.         WEND
  240.         IF x = mx2 THEN xright(y) = xleft(y) ELSE xright(y) = x
  241.     NEXT
  242.     _DEST destHandle&
  243.     FOR y = 0 TO mx2
  244.         IF xleft(y) <> mx2 THEN LINE (xleft(y) + x0 - max, y + y0 - max)-(xright(y) + x0 - max, y + y0 - max), c, BF
  245.     NEXT
  246.     _FREEIMAGE tef
  247.  
  248.  

Update of Candy Corn Color Scheme too:
 
Halloween Time 2.PNG
« Last Edit: October 23, 2019, 01:15:09 pm by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Halloween Time
« Reply #6 on: October 23, 2019, 04:03:52 pm »
I did not think it was possible. You have improved the program. Well done!!  Hmm... That did not sound right... "not" the "Well done", the other stuff...

Clarification: I did not think the "program" could be improved. I was "not" implying that it was not possible for "you" to improve the program...

(I hope I am making sense... I tend to 'ramble' when my levels of caffeine are extremely low....)
Logic is the beginning of wisdom.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Halloween Time
« Reply #7 on: October 26, 2019, 03:21:41 am »
YES!
it is more wonderful than the first... the lighting was a little flashing, here who has bad eyes like me can appreciate more the clock!
It is so cute that I think it must have a soundtrack....
like one of these
https://www.youtube.com/watch?v=GHfI3GiChVk
https://www.youtube.com/watch?v=YxOZuHemLXI
https://www.youtube.com/watch?v=jzDoO52Rw6c

or if you prefer tiktock sound
https://www.youtube.com/watch?v=QvRl1SZzOwQ
https://www.youtube.com/watch?v=uKwvTrKk9vE
https://www.youtube.com/watch?v=R3qu5nE-gGo
https://www.youtube.com/watch?v=WDCFdXFI_MU
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Halloween Time
« Reply #8 on: October 26, 2019, 10:20:58 am »
Hey TempodiBasic,

:-)) yeah maybe chime the hour with that first one, "Hi I'm Chucky!" that's creepy...

Tic-toc is too boring maybe this?
* LotsOfBats.mp3 (Filesize: 42 KB, Downloads: 134)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Halloween Time
« Reply #9 on: October 27, 2019, 08:28:13 pm »
Quote
LOL Bplus that's really cool looking! Could be used in a haunted house or carnival. :)

How about for trick or treat?

Will need to download, Scary Demon Haunting, here: http://soundbible.com/1883-Scary-Demon-Haunting.html
* Hypno Eye.zip (Filesize: 676.26 KB, Downloads: 132)
« Last Edit: October 27, 2019, 08:33:47 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Halloween Time
« Reply #10 on: October 27, 2019, 11:05:01 pm »
LOL I downloaded it and after 5 seconds I had to turn it off... too hardcore for me. :)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Halloween Time
« Reply #11 on: October 28, 2019, 11:51:27 am »
LOL I downloaded it and after 5 seconds I had to turn it off... too hardcore for me. :)


Ha! well if that totally creeps you out then right!, don't download Hypno Eye. ;-))