Rotating images

James Hurley jhurley0305 at sbcglobal.net
Sat Apr 25 10:09:39 EDT 2009


> --------------------------
>
> Message: 12
> Date: Fri, 24 Apr 2009 17:49:05 -0700
> From: Scott Rossi <scott at tactilemedia.com>
> Subject: Re: Rotating images
> To: Revolution Mail List <use-revolution at lists.runrev.com>
> Message-ID: <C617AC11.411B3%scott at tactilemedia.com>
> Content-Type: text/plain;	charset="US-ASCII"
>
> Recently, Randall Reetz wrote:
>
>> Can one rotate images by degree or fraction of degree?
>
> You should be able to rotate an image simply by using:
>
>  set the angle of img "myCoolImage" to 45
>
> The docs say the numeric value is an integer so like most position- 
> based
> things in Rev you can only use whole numbers, no fractions.  Until  
> Rev gets
> subpixel positioning, we won't be able to accomplish fine  
> positioning of
> graphics and images.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, Multimedia & Design
>

Scott (and Randall),

I've been playing with moving images around a loop while keeping the  
image oriented along the tangent and found some strange things about  
the input that RR allows.

It turns out that RR will truncate a fractional angle for you. (See  
script below.)
It will also accept fractional input to "move image from pt1 to pt2"  
where the two points have fractional items, but will not accept a  
fractional input to "Move image to tPt" if tPt contains fractional  
items.

Nor will RR accept fractional input to setLoc but there will be no  
error message. It just interest a return into the list of points and  
you get a gap in the line, or nothing if all the points are fractional.

I put in a request many years ago asking that RR do all the truncating  
in the engine. Sooo much simpler. If that request is still active, I  
would appreciate your vote. (The trouble is that I means I have to  
keep two sets of books for the graphic points, one for calculating the  
tangent angle and one for setting the graphic points to display the  
graphic.)

So in summary:

Accepts fractional input:
    Move object  from pointA to pointB
    Set angle  of image to tAngle

Does not accept fractional input:
    Move object to tPoint
    Set the loc of object to tPoint

Script to test:

on mouseUp
    put 100/3, 200/3 into tLoc
    put 400/3,600/4 into tNewloc
    move image 1 from tLoc to tNewLoc--This works.
    --but: move image 1 to tLoc fails with the message "tLoc is not a  
point"
    --and set the loc of image 1 to tLoc also fails


    --To test "set angle" using fractional input:
    set the angle of image 1 to 0
    wait 1 tick--Necessary on the Mac to get a screen refresh
    put 10 into i
    repeat
       add .1 to i
       set the angle of image 1 to i
       put the angle of image 1  & cr after results
       if i > 30 then exit repeat
    end repeat
    put results into msg box
    --You will find only integer values in the message box
    --RR will truncate the angle input for you.
end mouseUp






More information about the use-livecode mailing list