09-12-2024, 11:51 PM
(09-12-2024, 11:44 PM)Dav Wrote: Woah, that's pretty tight coding, Steve. I ain't even gonna try to shorten that.
- Dav
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
flip_coin: For i = start To fini Step Sgn(fini - start)
_Display: Cls
Circle (300, 200), 100, -1~&, , , asp(i)
Paint (300, 200), col(col), -1~&
If _KeyDown(27) Then System Else _Limit 60
Next
Swap start, fini: If start = 90 Then col = Not col ' flip colors on odd cycles
GoTo flip_coin
Think that's about as compact as I can get it. This version even makes the ESC sequence more responsive by keeping it inside the innermost loop. At this point, all I can see is just merging lines with colons to try and pretend like we're getting them shorter.
13 lines isn't so bad for something like this, is it?