sprite.getScaledHeight()

Category:Sprites

The scaled height of the sprite's current image in pixels. If no image or animation are set, it’s the scaled height of the placeholder rectangle.

The sprite.scale property can be used to scale a sprite larger or smaller and keep the height to width ratio constant. For some games or animations you may need to know the actual height of the scaled sprite in pixels.

Examples

var sprite = createSprite(200, 200);
sprite.scale=0.75;
drawSprites();
console.log(sprite.width);
console.log(sprite.height);
console.log(sprite.getScaledWidth());
console.log(sprite.getScaledHeight());

Syntax

sprite.getScaledHeight()

Returns

The scaled height of the sprite.

Tips

Found a bug in the documentation? Let us know at documentation@code.org