Lingo Dictionary > O-R > rotation |  |

rotation

Syntax

    the rotation of member whichQuickTimeMember
    member(whichQuickTimeMember).rotation
    sprite(whichSprite).rotation
    the rotation of sprite whichSprite

Description

Cast member property and sprite property; controls the rotation of a QuickTime movie, animated GIF, Flash movie, or bitmap sprite within the sprite's bounding rectangle, without rotating that rectangle or the sprite's controller (in the case of QuickTime). In effect, the sprite's bounding rectangle acts as a window through which you can see the Flash or QuickTime movie. The bounding rectangles of bitmaps and animated GIFs change to accommodate the rotating image.

Score rotation works for a Flash movie only if `obeyScoreRotation` is set to `TRUE`.

A Flash movie rotates around its origin point as specified by its `originMode` property. A QuickTime movie rotates around the center of the bounding rectangle of the sprite. A bitmap rotates around the registration point of the image.

For QuickTime media, if the sprite's `crop` property is set to `TRUE`, rotating the sprite frequently moves part of the image out of the viewable area; when the sprite's `crop` property is set to `FALSE`, the image is scaled to fit within the bounding rectangle (which may cause image distortion).

You specify the rotation in degrees as a floating-point number.

The Score can retain information for rotating an image from +21,474,836.47° to -21,474,836.48° , allowing 59,652 full rotations in either direction.

When the rotation limit is reached (slightly past the 59,652th rotation), the rotation resets to +116.47° or -116.48° —not 0.00° . This is because +21,474,836.47° is equal to +116.47° , and -21,474,836.48° is equal to -116.48° (or +243.12° ). To avoid this reset condition, when you use Lingo to perform continuous rotation, constrain the angles to ±360° .

This property can be tested and set. The default value is 0.

Example

The following behavior causes a sprite to rotate continuously by 2° every time the playback head advances, limiting the angle to 360° :

    property spriteNum

    on prepareFrame me
    	sprite(spriteNum).rotation = integer(sprite(spriteNum).rotation + 2) mod 360
    end

Example

This frame script keeps the playback head looping in the current frame while it rotates a QuickTime sprite in channel 5 a full 360° in 16° increments. When the sprite has been rotated 360° , the playback head continues to the next frame.

    on exitFrame
    	if sprite(5).rotation < 360 then
    		sprite(5).rotation = sprite(5).rotation + 16
    		go the frame
    	end if
    end

Example

This handler accepts a sprite reference as a parameter and rotates a Flash movie sprite 360° in 10° increments:

    on rotateMovie whichSprite
    	repeat with i = 1 to 36
    		sprite(whichSprite).rotation = i * 10
    		updatestage
    	end repeat
    end

See also

`flipH`, `flipV`, `obeyScoreRotation, originMode`