crop(rect, copy)
Crop allows you to crop the texture being used to display this Game Object.
Setting a crop rectangle modifies the core texture frame. The Game Object width and height properties will be adjusted accordingly.
Cropping takes place from the top-left and can be modified in real-time either by providing an updated rectangle object to this method,
or by modifying cropRect property directly and then calling updateCrop.
The rectangle object given to this method can be either a Phaser.Rectangle or any other object
so long as it has public x, y, width, height, right and bottom properties.
A reference to the rectangle is stored in cropRect unless the copy parameter is true,
in which case the values are duplicated to a local object.
Parameters
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
rect | Phaser.Rectangle | The Rectangle used during cropping. Pass null or no parameters to clear a previously set crop rectangle. | ||
copy | boolean | <optional> | false | If false |
- Inherited From
- Source code: gameobjects/components/Crop.js (Line 49)
Please login to continue.