---
title: "cos"
description: "The cosine of an angle in radians, −1..1."
group: "space"
groupTitle: "Shapes, frames & warps"
categoryId: "math"
categorySlug: "math"
categoryTitle: "Math"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/math.ts#L206"
---

# cos

The cosine of an angle in radians, −1..1.

```ts
cos(x: Val): Expr
```

Import `math` from `shaders/std` and use `math.cos`.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `x` | `Val` |  |

## Example

```ts
const spun = rotate2(delta, cos(angle), sin(angle))
```

> **Tip.** A degrees prop needs `mul(angle, 0.017453292519943295)` first.

## See also

- [`sin`](/docs/primitives/math/sin) — The sine of an angle in radians, −1..1.
- [`rotate2`](/docs/primitives/math/rotate2) — A 2D point rotated around the origin.

## Used by

[Chrome](/docs/components/chrome), [Crystal](/docs/components/crystal), [FlowingGradient](/docs/components/flowinggradient), [Goo](/docs/components/goo), [MeshGradient](/docs/components/meshgradient), [ReactionDiffusion](/docs/components/reactiondiffusion), [Voxels](/docs/components/voxels)