# rotateX

> Rotates the element in 3D around its horizontal axis for a flip-card or page-turn effect.

```ts
import { rotateX } from "@sdxc/u/transform";
```

Rotates the element in 3D around its horizontal axis for a flip-card or
page-turn effect. Pair with `u.backfaceVisibility()` to keep the reversed
face hidden mid-rotation, and compose freely with other `transform/` utilities.

## Quick reference

Every documented call, beside the CSS it emits.

| Call | CSS |
| --- | --- |
| `u.rotateX(180)` | `css({ "--ui-rotate-x": "180deg", transform: "... rotateX(var(--ui-rotate-x, 0deg)) ..." })` |

## Examples

### Basic example

Use `rotateX(n)` with a number of degrees to tip an element around its horizontal axis, and `perspective()` on the parent to give it depth:

```tsx
<div mix={[...]}>
	<div mix={[perspective(400), ...]}>
		<div mix={[rotateX(30), ...]}>rotateX(30)</div>
	</div>
	<div mix={[perspective(400), ...]}>
		<div mix={[rotateX(50), ...]}>rotateX(50)</div>
	</div>
	<div mix={[perspective(400), ...]}>
		<div mix={[rotateX(-50), ...]}>rotateX(-50)</div>
	</div>
</div>
```

### Adding perspective

Without a `perspective()` on the parent, `rotateX()` reads as a flat vertical squash; with one, the far edge recedes:

```tsx
<div mix={[...]}>
	<div mix={[...]}>
		<div mix={[rotateX(55), ...]}>flat</div>
	</div>
	<div mix={[perspective(300), ...]}>
		<div mix={[rotateX(55), ...]}>perspective(300)</div>
	</div>
</div>
```

### Flipping on hover

Combine it with `hover()` and a `transition("transform")` to flip an element over. Hover the tile to try it:

```tsx
<div mix={[...]}>
	<div mix={[perspective(400), ...]}>
		<div mix={[hover(rotateX(180)), transition("transform", { duration: 500 }), ...]}>
			hover me
		</div>
	</div>
</div>
```

## Using a custom value

Every scale argument also takes a raw CSS value, which passes through untouched.

```ts
u.rotateX("2.75rem")
```

## Applying on a state

Wrap the call in a state utility to scope it to one selector.

```ts
u.hover(u.rotateX(180))
```

## Responsive design

Wrap the call in a container query to scope it to one width.

```ts
u.at("md", u.rotateX(180))
```

## Signature

```ts
u.rotateX(value: AngleValue)
```
