Search code examples
iosswiftsprite-kitsktextureskcropnode

What is the meaning of "nonuniformly scaled texture" in SpriteKit?


On SKCropNode class reference, some examples to specify a mask are given.

Here they are:

This means a crop node can use simple masks derived from a piece of artwork, but it can also use more sophisticated masks. For example, here are some ways you might specify a mask:

  • An untextured sprite that limits content to a rectangular portion of the scene.

  • A textured sprite is a precise per-pixel mask. But consider also the benefits of a nonuniformly scaled texture. You could use a nonuniformly scaled texture to create a mask for a resizable user-interface element (such as a health bar) and then fill the masked area with dynamic content.

  • A collection of nodes can dynamically generate a complex mask that changes each time the frame is rendered.

The second example introduce nonuniformly scaled texture: what's the meaning of this?

This does not help me to understand this second example!


Solution

  • A non-uniformly scaled texture is a texture that is applied to a sprite with xScale != yScale.