Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Little Challenge: Spin the Circle
#1
Can anyone make this program shorter and smoother? I played with it for a while and it's pretty good, but I'm wondering if there's a simpler, better approach to using the ASPECT value. (bplus, I'm looking at you.  Wink)

Code: (Select All)
Option _Explicit '                   A Spinning Circle
Screen _NewImage(600, 400, 32)
Dim As Integer b, c, counter '                  Playing with Aspects
Dim As Single aspect, adder
Dim As _Unsigned Long col
$Color:32
counter = 0: col = Red
Do
    aspect = 1: adder = .015 '                 initial values
    '                                                      ASPECTS 1 TO 70
    For c = 1 To 9
        For b = 1 To 10 '                           redraw circle 10 times adding to the aspect each loop
            Cls
            aspect = aspect + adder '          increase the aspect by adder
            Circle (_Width / 2, _Height / 2), 100, White, , , aspect
            Paint (_Width / 2, _Height / 2), col, White
            _Limit 110
            _Display
        Next b
        If aspect >= 70 Then Exit For '       @ ~90 degrees drop thru to reverse loops
        adder = adder * 2 '                        adder amounts have to double after each 10-loop cycle to look right-ish
    Next c
    '                                                       * now reverse the process *
    counter = counter + 1
    If counter Mod 2 <> 0 Then If col = Red Then col = Green Else col = Red '  flip colors on odd cycles

    For c = 1 To 9 '                                  ASPECTS 70 TO 1
        For b = 1 To 10
            Cls
            aspect = aspect - adder
            Circle (_Width / 2, _Height / 2), 100, White, , , aspect
            If aspect <= 1 Then Exit For
            Paint (_Width / 2, _Height / 2), col, White
            _Limit 110
            _Display
        Next b
        adder = adder / 2 '
    Next c

    counter = counter + 1
    If counter = 4 Then counter = 0
    If _KeyDown(27) Then System
Loop
System
Reply


Messages In This Thread
A Little Challenge: Spin the Circle - by NakedApe - 09-10-2024, 10:15 PM
RE: A Little Challenge: Spin the Circle - by Dav - 09-12-2024, 11:44 PM



Users browsing this thread: 3 Guest(s)