texture.width

Type Number
Object TextureResourceCanvas
Library graphics.*
Revision 2017.3060
See also TextureResource
TextureResourceCanvas
texture.height
texture.pixelWidth

Overview

This read-only property indicates the width in which objects can be rendered within a TextureResourceCanvas. Essentially, if a display object drawn to the canvas is equal to this width, it will occupy the entire horizontal space.

Unlike pixelWidth, this property is not read-only. The visual effect of changing it will be horizontal stretching or shrinking of rendered TextureResourceCanvas content. To see the changes, call texture:invalidate().

Gotchas

The default center of the canvas is 0, so the coordinates of the left and right edges will be -texture.width/2 and texture.width/2 respectively. This can be altered by changing texture.anchorX.