Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Little Challenge: Spin the Circle
#2
Yours is nice I think you can cut it in half by eliminating the 2nd loop, seems like you might be able to change aspect like I change xr below.

here is a different approach:

Code: (Select All)
_Title "Spinning Circle" ' b+ 2024-09-10  highlight front edge
Screen _NewImage(620, 620, 32)
_ScreenMove 300, 60
cx = 308: cy = 308: xr = 0: dxr = 1: dyr = 1: yr = 300: c1~& = &HFFFF0000
Do
Cls
FEllipse cx, cy, xr, 300, &HFFFFFFFF
FEllipse 310, 310, xr, 300, c1~&
xr = xr + dxr
If xr > 300 Then dxr = -dxr: xr = 299: cx = 312: cy = 312: _Delay .1
If xr < 0 Then
dxr = -dxr: xr = 1: cx = 308: cy = 308
If c1~& = &HFFFF0000 Then c1~& = &HFF008800 Else c1~& = &HFFFF0000
End If
_Display
_Limit 120
Loop Until _KeyDown(27)

Sub FEllipse (CX As Long, CY As Long, xr As Long, yr As Long, C As _Unsigned Long)
If xr = 0 Or yr = 0 Then Exit Sub
Dim h2 As _Integer64, w2 As _Integer64, h2w2 As _Integer64
Dim x As Long, y As Long
w2 = xr * xr: h2 = yr * yr: h2w2 = h2 * w2
Line (CX - xr, CY)-(CX + xr, CY), C, BF
Do While y < yr
y = y + 1
x = Sqr((h2w2 - y * y * w2) \ h2)
Line (CX - x, CY + y)-(CX + x, CY + y), C, BF
Line (CX - x, CY - y)-(CX + x, CY - y), C, BF
Loop
End Sub

Edit Correction: I was flipping colors too often sorry, should be OK now!
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
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 bplus - 09-10-2024, 11:59 PM
RE: A Little Challenge: Spin the Circle - by Dav - 09-12-2024, 11:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  blue circle isn't drawing and print isn't working? madscijr 12 2,339 09-21-2024, 06:13 PM
Last Post: madscijr
  Is there a faster way to do this glow circle effect? Dav 11 2,090 06-16-2024, 11:51 PM
Last Post: Dav

Forum Jump:


Users browsing this thread: 1 Guest(s)