Phaser API Documentation

  Version: 
setCropUVs(crop, x, y, width, height, flipX, flipY)

Description:

Takes a crop data object and, based on the rectangular region given, calculates the required UV coordinates in order to crop this Frame for WebGL and Canvas rendering.

This is called directly by the Game Object Texture Components setCrop method. Please use that method to crop a Game Object.

Parameters:

name type description
crop object

The crop data object. This is the GameObject._crop property.

x number

The x coordinate to start the crop from. Cannot be negative or exceed the Frame width.

y number

The y coordinate to start the crop from. Cannot be negative or exceed the Frame height.

width number

The width of the crop rectangle. Cannot exceed the Frame width.

height number

The height of the crop rectangle. Cannot exceed the Frame height.

flipX boolean

Does the parent Game Object have flipX set?

flipY boolean

Does the parent Game Object have flipY set?

Returns:
Description:

The updated crop data object.

Type:
  • object
Examples:
Since: 3.11.0
Source: src/textures/Frame.js (Line 454)