---
title: "fromRotation | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Function fromRotation

-   fromRotation(out: [mat2](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.mat2/), rad: number): [mat2](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.mat2/)[](#fromrotation)
    
    Creates a matrix from a given angle This is equivalent to (but much faster than):
    
    ```typescript
    mat2.identity(dest);
    mat2.rotate(dest, dest, rad);
    ```
    
    #### Parameters
    
    -   out: [mat2](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.mat2/)
        
        mat2 receiving operation result
        
    -   rad: number
        
        the angle to rotate the matrix by
        
    
    #### Returns [mat2](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.mat2/)
    
    out
