skew

Usage

-- Lingo syntax
spriteObjRef.skew

// JavaScript syntax
spriteObjRef.skew;

Description

Sprite property; returns, as a float value in hundredths of a degree, the angle to which the vertical edges of the sprite are tilted (skewed) from the vertical. Read/write.

Negative values indicate a skew to the left; positive values indicate a skew to the right. Values greater than 90° flip an image vertically.

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

When the skew limit is reached (slightly past the 59,652th rotation), the skew 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, constrain angles to ±360° in either direction when using script to perform continuous skewing.

Example

The following behavior causes a sprite to skew continuously by 2 degrees every time the playhead advances, while limiting the angle to 360 degrees.

-- Lingo syntax
property spriteNum

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

// JavaScript syntax
function prepareFrame() {
   sprite(this.spriteNum).skew = parseInt(sprite(this.spriteNum).skew + 2) 
% 360; }

See also

flipH, flipV, rotation, Sprite