Richmond Mathewson was >Having some problems with rotation...

I don't know anything much about rotating images, but if the project is just a clock then why not move a graphic around rather than rotate an image? I'm sure you could recalculate the points of even a quite complex graphic in very little time. The code below is from a clock that I built when first learning to use Revolution. It seems to work OK and you can get the trigonometric transformations from it.

on oneTick
  global gClockRunning
  if gClockRunning then send "oneTick" to me in 500 milliseconds
  set the tickMessageID of me to the result
  --seconds
  put the secondHandLength of group "clock" into L
  put the clockTime of group "clock" + 1 into currentTime
  put the long time into theTime
  convert theTime to dateItems
  put item 6 of theTime into mySec
  add item 5 of theTime*60 to mySec
  add item 4 of theTime*3600 to mySec
  put -pi/2 +mySec*2*pi/60 into theta
  put round(L*sin(theta)) into y
  put round(L*cos(theta)) into x
  put the loc of graphic "spindle" into myPoint
  add x to item 1 of myPoint
  add y to item 2 of myPoint
  put the loc of graphic "spindle"  & return & myPoint into handPoints
  set the points of graphic "secondHand" to handPoints
  --minutes (do only every 6 seconds)
  if currentTime mod 6 = 0 then
    put the minuteHandLength of group "clock" into L
    put -pi/2 +mySec*2*pi/3600 into theta
    put round(L*sin(theta)) into y
    put round(L*cos(theta)) into x
    put the loc of graphic "spindle" into myPoint
    add x to item 1 of myPoint
    add y to item 2 of myPoint
    put the loc of graphic "spindle"  & return & myPoint into handPoints
    set the points of graphic "minuteHand" to handPoints
  end if
  --hours (do only every 60 seconds)
  if currentTime mod 60 = 0 then
    put the hourHandLength of group "clock" into L
    put -pi/2 +mySec*2*pi/(12*60*60) into theta
    put round(L*sin(theta)) into y
    put round(L*cos(theta)) into x
    put the loc of graphic "spindle" into myPoint
    add x to item 1 of myPoint
    add y to item 2 of myPoint
    put the loc of graphic "spindle"  & return & myPoint into handPoints
    set the points of graphic "hourHand" to handPoints
  end if
end oneTick

Regards,
--
Michael J. Lew

Senior Lecturer
Department of Pharmacology
The University of Melbourne
Parkville 3010
Victoria
Australia

Phone +613 8344 8304

**
New email address: [EMAIL PROTECTED]
**
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to