l i v e c o d e

Rotating an Image To Follow the Mouse
Mac OS 9 Mac OS X Windows Linux

Start with a transparent GIF or PNG image, and import it onto a card. — Editor

Try this - it works:
-- card script

on mouseMove
  -- an "aim" checkbox turns it on/off
  if the hilite of btn "aim" = false then exit mouseMove

  put (the mouseH - (item 1 of the loc of img 1)) into x
  put (the mouseV - (item 2 of the loc of img 1)) into y
  set the angle of img 1 to ((atan2(x,y) *180) / pi) - 90
end mouseMove
(I forgot to use the 'mouseMove' params - if you do, that'll make it yours!)


Posted 4/24/2002 by Phil Davis to the MetaCard List   (See the complete post/thread)

 Print this tip

News and Rumors Products Services Developer Resources Contact STS About STS