i WANTED TO SEE THAT DONUT SPIN. My specialized Ellipse/circle rotation algo is PERFECT for this :). Follows the mouse too.
'* cgEllipseMapImage
wiley& = _LOADIMAGE("DONUT WITH CODE SPRINKLES.PNG", 32)
h& = _NEWIMAGE(_WIDTH(wiley&), _HEIGHT(wiley&), 32)
SCREEN h&
_SCREENMOVE _MIDDLE
pi# = 3.1415926535897932386#
wwiley% = _WIDTH(wiley&)
hwiley% = _HEIGHT(wiley&)
'* plots to circle if xmag! = ymag!, otherwise an ellipse
xmag! = 1
ymag! = 1
_SOURCE wiley&
_DEST h&
DO
rot! = rot! + (2 * pi#) / 20
CLS
IF wwiley% < hwiley% THEN
radius% = wwiley% / 2
ELSE
radius% = hwiley% / 2
END IF
rlimit% = radius% / 4
gx% = radius% + (wwiley% - radius% * 2)
gy% = radius% + (hwiley% - radius% * 2)
DO WHILE _MOUSEINPUT
offsetx% = _MOUSEX
offsety% = _MOUSEY
LOOP
'offsetx% = xmag! * radius% + (_WIDTH(h&) - 2 * xmag! * radius%)
'offsety% = ymag! * radius% + (_HEIGHT(h&) - 2 * ymag! * radius%)
DO
circloop& = 0
circ! = 2 * pi# * radius%
DO
xscan! = gx% + radius% * COS(2 * pi# * (circloop& / circ!))
yscan! = gy% + radius% * SIN(2 * pi# * (circloop& / circ!))
x& = POINT(xscan!, yscan!)
plotx! = gx% + radius% * COS(rot! + 2 * pi# * (circloop& / circ!))
ploty! = gy% + radius% * SIN(rot! + 2 * pi# * (circloop& / circ!))
PSET (offsetx% + (plotx! - gx%) * xmag!, offsety% + (ploty! - gy%) * ymag!), x&
circloop& = circloop& + 1
LOOP UNTIL circloop& > circ!
radius% = radius% - 1
LOOP UNTIL radius% < rlimit%
_DISPLAY
_LIMIT 10
LOOP UNTIL INKEY$ > ""
SCREEN 0
_FREEIMAGE h&
_FREEIMAGE wiley&
SYSTEM