> 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/general-properties/rotation.md).

# Rotation

## Introduction

`Rotation` can be used to rotate Gum components. Rotation is measured in degrees, where positive values rotate an object counterclockwise about its origin ([X Origin](/gum/gum-tool/gum-elements/general-properties/x-origin.md) and [Y Origin](/gum/gum-tool/gum-elements/general-properties/y-origin.md)).

## Example

An object is rotated about its origin, which by default is its top-left corner:

![Rotating an object using the Rotation variable](https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-f00d9ec395a1b3d0a36b5beb16efafb04a87baab%2F16_08%2005%2018.gif?alt=media)

Objects can also be rotated visually by grabbing the rotation handle:

![Rotation handles can rotate an object](https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-539267371d76d2353dc905867e6c4b6ff6cc8b31%2F16_08%2006%2014.gif?alt=media)

Holding the SHIFT key snaps angles to 15 degree increments.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-0a0d31d484edead21b122f83ff249e21b93f607e%2F16_08%2007%2048.gif?alt=media" alt=""><figcaption><p>SHIFT rotate snaps to 15 degree increments</p></figcaption></figure>

## X Origin and Y Origin

The [X Origin](/gum/gum-tool/gum-elements/general-properties/x-origin.md) and [Y Origin](/gum/gum-tool/gum-elements/general-properties/y-origin.md) properties define the point of rotation for an object. The following animation shows how changing origin values can affect rotation.

![Objects rotate about their origin.](https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-32686e3c5b4ccf733cf21670dd7d358987c9cec8%2F16_08%2014%2023.gif?alt=media)

{% hint style="info" %}
Rotation does not rotate the clip region of a container that clips its children, so rotating a container with [Clips Children](/gum/gum-tool/gum-elements/general-properties/clips-children.md) set to `true` will look broken. To rotate a container *and* keep its contents clipped, see [Rotating and Scaling Clipped Contents](/gum/gum-tool/tutorials-and-examples/examples/rotating-and-scaling-clipped-contents.md).
{% endhint %}

## Rotation in Stacks and Grids

Stacks and grids space a rotated child as if it were not rotated. With the default top-left origin, a rotated child can overlap its neighbors or leave gaps. With another origin, such as `Center`, the rotation also shifts where the next sibling starts in a stack. Auto Grid cells do not move. For more information see [Stacking and Rotation](/gum/gum-tool/gum-elements/container/children-layout.md#stacking-and-rotation).

{% hint style="warning" %}
Stacking with rotation may become more sophisticated in a future version of Gum, so this behavior may change.
{% endhint %}


---

# 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/general-properties/rotation.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.
