Author Topic: The Cobalt Spinner  (Read 7028 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: The Cobalt Spinner
« Reply #15 on: July 19, 2020, 08:50:30 pm »
Very nice Steve! I like the unique old fashioned feeling to it.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Cobalt Spinner
« Reply #16 on: July 19, 2020, 09:34:57 pm »
Here is the spinner without an image file!
Code: QB64: [Select]
  1. _TITLE "Bplus Spinner 2020-07-19"
  2. RANDOMIZE TIMER 'B+ spinner 2020-07-19
  3. CONST xmax = 600
  4. CONST ymax = 600
  5. TYPE vectorType
  6.     x AS SINGLE
  7.     y AS SINGLE
  8. DIM SHARED wheel&
  9. SCREEN _NEWIMAGE(xmax, ymax, 32)
  10. _DELAY .25
  11. ca = _PI(2 / 36): wheelOffset = 6: dir = 1
  12. makeWheel
  13.     FOR a = 0 TO _PI(2) STEP _PI(2 / 36) ' give it a right quick start
  14.         CLS
  15.         RotoZoom2 _WIDTH / 2, _HEIGHT / 2, wheel&, 1, 1, -dir * a
  16.         LINE (295, 85)-STEP(10, 30), &HFFFFFF00, BF
  17.         _DISPLAY
  18.         _LIMIT 50
  19.     NEXT
  20.     stopAt = INT(RND * 36): i1 = 2: i2 = 1
  21.     FOR a = 0 TO _PI(2) + stopAt * ca STEP _PI(2 / 36)
  22.         CLS
  23.         PRINT i1, i2
  24.         RotoZoom2 _WIDTH / 2, _HEIGHT / 2, wheel&, 1, 1, -dir * a
  25.         LINE (295, 85)-STEP(10, 30), &HFFFFFF00, BF
  26.         'INPUT "OK ..."; w$
  27.         IF dir = 1 THEN
  28.             i2 = i2 + 1
  29.             IF i2 = 7 THEN i2 = 1: i1 = i1 + 1
  30.             IF i1 = 7 THEN i1 = 1
  31.         ELSE
  32.             i2 = i2 - 1
  33.             IF i2 = 0 THEN i2 = 6: i1 = i1 - 1
  34.             IF i1 = 0 THEN i1 = 6
  35.         END IF
  36.         _DISPLAY
  37.         _LIMIT stopAt + _PI(2) / ca - a / ca + 3
  38.     NEXT
  39.     IF RND < .5 THEN dir = -1 ELSE dir = 1
  40.     _DELAY 2
  41.  
  42. SUB makeWheel
  43.     ca = _PI(2 / 36)
  44.     DIM vdigit(0 TO 35) AS vectorType
  45.     DIM outer(0 TO 35) AS vectorType
  46.     x0 = 190: y0 = 190: radius = 150
  47.     'CIRCLE (x0, y0), radius
  48.     COLOR &HFFFFFFEE
  49.     CIRCLE (x0, y0), 187
  50.     CIRCLE (x0, y0), 150
  51.     ca = _PI(2 / 36)
  52.     FOR i = 0 TO 35
  53.         xe = x0 + 187 * COS(i * ca + .5 * ca): ye = y0 + 187 * SIN(i * ca + .5 * ca)
  54.         IF i MOD 6 = 2 THEN
  55.             x = x0: y = y0
  56.         ELSE
  57.             x = x0 + 150 * COS(i * ca + .5 * ca): y = y0 + 150 * SIN(i * ca + .5 * ca)
  58.         END IF
  59.         px = x0 + 160 * COS(i * ca + .25 * ca)
  60.         py = y0 + 160 * SIN(i * ca + .25 * ca)
  61.         LINE (x, y)-(xe, ye)
  62.         IF i > 0 THEN
  63.             IF i MOD 2 THEN PAINT (px, py), &HFFFF0000, &HFFFFFFEE ELSE PAINT (px, py), &HFFFFFFFF, &HFFFFFFEE
  64.         END IF
  65.         IF INT(i / 6) > 0 THEN
  66.             px1 = x0 + 100 * COS(i * ca + .25 * ca)
  67.             py1 = y0 + 100 * SIN(i * ca + .25 * ca)
  68.             IF INT(i / 6) MOD 2 THEN
  69.                 PAINT (px1, py1), &HFFFF0000, &HFFFFFFEE
  70.             ELSE
  71.                 PAINT (px1, py1), &HFFFFFFFF, &HFFFFFFEE
  72.             END IF
  73.         END IF
  74.         '_LIMIT 5
  75.     NEXT
  76.     px = x0 + 160 * COS(i * ca + .25 * ca)
  77.     py = y0 + 160 * SIN(i * ca + .25 * ca)
  78.     IF i > 0 THEN
  79.         IF i MOD 2 THEN PAINT (px, py), &HFFFF0000, &HFFFFFFEE ELSE PAINT (px, py), &HFFFFFFFF, &HFFFFFFEE
  80.     END IF
  81.     px1 = x0 + 100 * COS(i * ca + .25 * ca)
  82.     py1 = y0 + 100 * SIN(i * ca + .25 * ca)
  83.     IF INT(i / 6) MOD 2 THEN
  84.         PAINT (px1, py1), &HFFFF0000, &HFFFFFFEE
  85.     ELSE
  86.         PAINT (px1, py1), &HFFFFFFFF, &HFFFFFFEE
  87.     END IF
  88.     FOR i = 0 TO 35
  89.         vdigit(i).x = x0 + radius * COS(ca * i - 2 * ca)
  90.         vdigit(i).y = y0 + radius * SIN(ca * i - 2 * ca)
  91.         'CIRCLE (vdigit(i).x, vdigit(i).y), 2
  92.         x = x0 + (radius + 18) * COS(ca * i - 2 * ca)
  93.         y = y0 + (radius + 18) * SIN(ca * i - 2 * ca)
  94.         IF i MOD 2 THEN c~& = &HFFFFFFFF ELSE c~& = &HFFFF0000
  95.         drwChar LTRIM$(STR$((i + 1) MOD 6 + 1)), c~&, x, y, 2, 2, ca * i - 2 * ca - _PI(1.5)
  96.         outer(i).x = x0 + (radius + r2) * COS(ca * i - 2 * ca)
  97.         outer(i).y = y0 + (radius + r2) * SIN(ca * i - 2 * ca)
  98.     NEXT
  99.     ca = _PI(2 / 6): radius = 80
  100.     FOR i = 0 TO 5
  101.         vdigit(i).x = x0 + radius * COS(ca * i - 2 * ca)
  102.         vdigit(i).y = y0 + radius * SIN(ca * i - 2 * ca)
  103.         'CIRCLE (vdigit(i).x, vdigit(i).y), 2
  104.         x = x0 + (radius + 18) * COS(ca * i - 2 * ca)
  105.         y = y0 + (radius + 18) * SIN(ca * i - 2 * ca)
  106.         IF i MOD 2 THEN c~& = &HFFFFFFFF ELSE c~& = &HFFFF0000
  107.         drwChar LTRIM$(STR$(i MOD 6 + 1)), c~&, x, y, 6, 6, ca * i - 2 * ca - _PI(1.5)
  108.         outer(i).x = x0 + (radius + r2) * COS(ca * i - 2 * ca)
  109.         outer(i).y = y0 + (radius + r2) * SIN(ca * i - 2 * ca)
  110.     NEXT
  111.     wheel& = _NEWIMAGE(380, 380, 32)
  112.     _PUTIMAGE (0, 0)-(380, 380), 0, wheel&, (0, 0)-(380, 380)
  113.  
  114. SUB drwChar (char$, c AS _UNSIGNED LONG, midX, midY, xScale, yScale, Rotation) 'what ever the present color is set at
  115.     I& = _NEWIMAGE(8, 16, 32)
  116.     _DEST I&
  117.     COLOR c, &H00000000
  118.     _PRINTSTRING (0, 0), char$
  119.     _DEST 0
  120.     RotoZoom2 midX, midY, I&, xScale, yScale, Rotation
  121.     _FREEIMAGE I&
  122.  
  123.  
  124. SUB RotoZoom2 (X AS LONG, Y AS LONG, Image AS LONG, xScale AS SINGLE, yScale AS SINGLE, Rotation AS SINGLE)
  125.     DIM px(3) AS SINGLE: DIM py(3) AS SINGLE
  126.     W& = _WIDTH(Image&): H& = _HEIGHT(Image&)
  127.     px(0) = -W& / 2: py(0) = -H& / 2: px(1) = -W& / 2: py(1) = H& / 2
  128.     px(2) = W& / 2: py(2) = H& / 2: px(3) = W& / 2: py(3) = -H& / 2
  129.     sinr! = SIN(-Rotation): cosr! = COS(-Rotation)
  130.     FOR i& = 0 TO 3
  131.         x2& = (px(i&) * cosr! + sinr! * py(i&)) * xScale + X: y2& = (py(i&) * cosr! - px(i&) * sinr!) * yScale + Y
  132.         px(i&) = x2&: py(i&) = y2&
  133.     NEXT
  134.     _MAPTRIANGLE (0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image& TO(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
  135.     _MAPTRIANGLE (0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image& TO(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
  136.  
  137.  

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: The Cobalt Spinner
« Reply #17 on: July 19, 2020, 09:42:31 pm »
Very cool B+. In the beginning I tried to make everything without files but I had no idea that PAINT could have a start and end color, until you just showed yours. LOL

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: The Cobalt Spinner
« Reply #18 on: July 19, 2020, 10:09:49 pm »
And to think I was just goofing off! Wow this topic went farther than I had anticipated! XD


Well here have an animated gif I made with me own pics!

how odd, it doesn't act like an animated gif... should be.. is on my hard drive...???
not sure whats going on that should be 9 frames but its acting like a single frame when I test downloaded it. not sure whats up with that.

 
comet64x48.gif
« Last Edit: July 20, 2020, 12:26:42 pm by odin »
Granted after becoming radioactive I only have a half-life!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: The Cobalt Spinner
« Reply #19 on: July 20, 2020, 04:59:12 am »
Here's a wacky thought... What about using 'both' types of rotation. Disc in one direction and the arrow in the other... Talk about random...
Logic is the beginning of wisdom.

FellippeHeitor

  • Guest
Re: The Cobalt Spinner
« Reply #20 on: July 20, 2020, 12:32:18 pm »
Testing...

 
ezgif.com-gif-maker.gif


 
QB64_1.3_release.gif

FellippeHeitor

  • Guest
Re: The Cobalt Spinner
« Reply #21 on: July 20, 2020, 12:35:02 pm »
Final test...

 
ezgif.com-gif-maker-2.gif

FellippeHeitor

  • Guest
Re: The Cobalt Spinner
« Reply #22 on: July 20, 2020, 12:35:34 pm »
Here, I used this corrupted GIF repair utility: https://ezgif.com/repair

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Cobalt Spinner
« Reply #23 on: July 20, 2020, 12:39:08 pm »
The gif is cool! but that comet doesn't look right?

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: The Cobalt Spinner
« Reply #24 on: July 20, 2020, 05:30:36 pm »
The gif is cool! but that comet doesn't look right?

How so?

I have over 100 images I took Thursday. I'm going to try and gif together, but I will probably turn it into a video and upload it to YT instead. as for some reason the forum don't like my gifs. and it will be several megs in size.
Granted after becoming radioactive I only have a half-life!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Cobalt Spinner
« Reply #25 on: July 20, 2020, 05:35:42 pm »
I was expecting comet tail to follow the direction it's going (why else call it a tail?) but I guess it always points away from the sun. Learn something new...


Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: The Cobalt Spinner
« Reply #26 on: July 20, 2020, 06:44:02 pm »
Comets usually follow long elliptical orbits. The "tail" does not normally show until it nears the Sun. Although the "body" of the comet follows the orbit, the tail, being less in mass, is influenced by 'Solar Wind' and as a result, the 'tail' will point away from the Sun. So therefore, when you see a comet, the 'tail' will indicate the direction of the Sun and not the direction that the comet is traveling. I hope this helps.
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Cobalt Spinner
« Reply #27 on: July 20, 2020, 06:50:38 pm »
OK now about the UFO in one frame?

What's the scientific explanation for that? Elmo's Fire?


Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: The Cobalt Spinner
« Reply #28 on: July 20, 2020, 07:45:10 pm »
Lightning Bug. :D

Several of my Thursday batch have nice glowing trails cause the exposure time was ~20 seconds so any light that happens to flash in the sky gets caught to some degree. have some satellite trails too. missed the shooting star I saw Thursday, go figure! Supposed to be a bit of a meteor shower next week around the 28th I believe to be the highlight night.

Camera will only take up to 10 consecutive shots at a time, which takes just around 4-4 1/2 mins to complete so depending on conditions I might just catch one. but the comet was my highlight this year.
In 2024 when the solar eclipse passes over head I will be in the path of totality, for about 3:33 secs, or I could drive about 15 miles north and be in the center of the path! Hoping to have a telephoto lens for that one and catch the corona.

As for the static red, white, and blue dots, I'm not sure. Something tells me the sensor in my camera may be slightly damaged maybe? they don't really show in daylight photos, mainly just night shots.
« Last Edit: July 20, 2020, 07:47:46 pm by Cobalt »
Granted after becoming radioactive I only have a half-life!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Cobalt Spinner
« Reply #29 on: July 20, 2020, 10:15:55 pm »
LOL a lightning bug! Of course.