Rotating a picture?

Malte Brill malte.brill at t-online.de
Fri Apr 25 12:41:01 EDT 2003


Hi Tim...

I cooked something up for you. Just Quick and dirty and I hope it works. :-)

You can not do it in realtime as most of the Computers will go into Nirvana
when trying to calculate the rotation, but you might try the following.

Create a scrollbar. Set its style to scalebar. Startvalue=0 Endvalue=720
Increment on clicking arrow/scrollbar=0

put the following script into it:

on init
  set the thumbPos of me to 360
  set the newthumb of me to 0
  set the oldthumb of me to 0
  set the lastthumb of me to 0
end init

on scrollbardrag
  set the newthumb of me to the thumbposition of me-360
end scrollbardrag

on mouseUp
  if the newThumb of me=the oldThumb of me then set the lastThumb of me to 0
  if the newThumb of me>=0 then
   if the oldThumb of me<the newThumb of me then
    set the lastThumb of me to the newThumb of me-the oldThumb of me
    set the oldthumb of me to the newthumb of me
   end if
   if the newThumb of me<the oldThumb of me then
    set the lastThumb of me to -the oldThumb of me+the newThumb of me
    set the oldthumb of me to the newthumb of me
   end if
  end if
  if the newThumb of me<0 then
    if the newThumb of me<the oldThumb of me then
     set the lastThumb of me to the newThumb of me-the oldThumb of me
     set the oldthumb of me to the newthumb of me
    end if
    if the newThumb of me>the oldThumb of me then
      set the lastThumb of me to (-the newThumb of me+the oldThumb of me)*-1
      set the oldthumb of me to the newthumb of me
    end if
   end if
   --put the newthumb of me, the oldthumb of me, the lastthumb of me
   rotate img 1 the lastthumb of me
end mouseUp


Send init to the scrollbar to initialize.

Hope this helps,

Malte




More information about the use-livecode mailing list