> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/gum/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/gum/gum-tool/gum-elements/sprite/wrap.md).

# Wrap

Introduction

The Wrap value controls whether the sprite wraps its image when rendering portions beyond the right and bottom image bounds. If this value is true then wrapping occurs. Otherwise, areas beyond the texture extend the last pixel - also known as "clamping" the value.

The Wrap variable applies when dealing with a **Texture Address** of **Custom** or **DimensionsBased**. Wrapping is not available when using a **Texture Address** value of **Entire Texture.**

### Wrap and Custom Texture Address

If Texture Address is set to Custom then wrapping is available. All examples in the Custom Texture Address section use the following values:

* Width = 100
* Width Units = Percentage of File Width
* Height = 100
* Height Units = Percentage of File Height

For more information, see the [Width Unit](/gum/gum-tool/gum-elements/general-properties/width-units.md) and [Height Unit](/gum/gum-tool/gum-elements/general-properties/height-units.md) pages.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-e37f152fc454b70e6b15968ebcc8b3077cf22fca%2Fimage.png?alt=media" alt=""><figcaption><p>Default Sprite width and height values are used in this section</p></figcaption></figure>

Toggling wrapping adjusts whether the Sprite wraps or clamps the area defined by the Texture Left, Texture Top, Texture Width, and Texture Height values.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-9225bfb0936cc39811e0b5eafbdb2a2c761a7ba0%2F22_06%2056%2055.gif?alt=media" alt=""><figcaption><p>A Sprite can wrap or clamp the area outside of the right and bottom bounds of its source</p></figcaption></figure>

A texture is wrapped if its Texture Right or Texture Bottom values are set to be larger than the source texture. For example, the following image shows a Sprite which is using an image that is 200x200. Its Texture Width is set to 500 and Texture Height is set to 300 so the sprite displays wrapping.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-51bdc9ae4f10221df80ef5746b0cae64ac4d6e59%2Fimage.png?alt=media" alt=""><figcaption><p>Sprite wrapping its image</p></figcaption></figure>

If the Texture Width or Texture Height values are adjusted, then the Sprite's wrapping also adjusts.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-9045be6115c44b5a3273b0f17e094fd4446379db%2F22_06%2055%2013.gif?alt=media" alt=""><figcaption><p>Adjusting Texture Width and Texture Heigh changes wrapping</p></figcaption></figure>

If Wrap is set to true, then wrapping happens for any area to the right or bottom of the bounds of the source. The following shows the bounds of a sprite moved in the Texture Coordinate tab resulting in the area that is being displayed wrapping and repeating.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-668df91dc88e0c0728ef949752f0ed3ba5d3d172%2F22_07%2002%2010.gif?alt=media" alt=""><figcaption><p>Sprite repeating the image as its texture address is moved to the right</p></figcaption></figure>

{% hint style="info" %}
If a Sprite's Texture Left or Texture Top are set to less than 0 then the Sprite clamps this area. This may change to wrap in future versions of Gum so this behavior should not be relied upon.

<img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-8bfebb880b8817a60650268387c02af87b68eda1%2Fimage.png?alt=media" alt="" data-size="original">
{% endhint %}

### Wrap and DimensionsBased

If a Sprite sets DimensionsBased for its Texture Address, then its source file can wrap if its dimensions are large enough to result in the texture width or texture height set to a value larger than the source dimensions.

All examples in the DimensionsBased Texture Address section use the following values:

* Width Units = Absolute
* Height Units = Absolute

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-6c11ad8448c443876ea4c679f6d82a60580ce355%2Fimage.png?alt=media" alt=""><figcaption><p>Sprite width and height values used in this section</p></figcaption></figure>

Toggling wrapping adjusts whether the Sprite wraps or clamps the area defined by the Texture Left, Texture Top, and its size.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-1aadd2e2a6689df93a30dd7afe14eddb4c2c0751%2F22_09%2023%2041.gif?alt=media" alt=""><figcaption><p>A Sprite can wrap or clamp the area outside of the right and bottom bounds of its source</p></figcaption></figure>

If a Sprite's width or height are adjusted, this results in its texture coordinate values also being modified. If Wrap is true then areas outside of the source file wrap.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-382f5d9ea0eac280e3af3cf4a9d31a61e25f63b3%2F22_09%2025%2042.gif?alt=media" alt=""><figcaption><p>The source image wraps if the width or height are adjusted Texture Address is DimensionsBased</p></figcaption></figure>

Wrapping can also be affected by changing the Texture Width Scale or Texture Height Scale. Smaller values result in image being drawn smaller, making it wrap more.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-fe8152b98c4876974d5421593fbe5957b2881671%2F22_09%2040%2021.gif?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flatredball.com/gum/gum-tool/gum-elements/sprite/wrap.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
