09-12-2024, 11:33 PM
Code: (Select All)
Screen _NewImage(600, 400, 32) 'A Spinning Circle: bplus mod 2 of NakedApe, tweaked by Steve for LOC
Dim As Integer i, start, fini, col ' Playing with Aspects
Dim As _Unsigned Long col(-1 To 0): col(0) = &HFFFF0000: col(-1) = &HFF00FF00
Dim asp(1 To 90): asp(1) = 1: start = 1: fini = 90
For i = 2 To fini: asp(i) = 1 / Cos(_D2R(i)): Next ' make an array of aspect values
Do ' Note: asp(i) = Cos(_D2R(i)) will spin on the other axis
For i = start To fini Step Sgn(fini - start)
Cls
Circle (300, 200), 100, -1~&, , , asp(i)
Paint (300, 200), col(col), -1~&
_Limit 60
_Display
Next
Swap start, fini: If start = 90 Then col = Not col ' flip colors on odd cycles
Loop Until _KeyDown(27)
Cleaned it up a bit more and removed some more unnecessary variables and such. If there's anything that seems obtuse in this, just ask and I'll be more than happy to explain the idea behind my changes.
I'm really pretty happy with this little brainstorm of an idea:
Code: (Select All)
For i = start To fini Step Sgn(fini - start)
Now all one needs do is swap start and fini, and that loop will count up by 1 or down by 1 automagically! How's that for a neat little trick of logic?