# Scenic.Primitive.Transform behaviour(Scenic v0.10.3) View Source

Change the position, rotation, scale and more of a primitive.

Unlike html, which uses auto-layout to position items on the screen, Scenic moves primitives around using matrix transforms. This is common in video games and provides powerful control of your primitives.

A matrix is an array of numbers that can be used to change the positions, rotations, scale and more of locations.

Don't worry! You will not need to look at any matrices unless you want to get fancy. In Scenic, you will rarely (if ever) create matrices on your own (you can if you know what you are doing!), and will instead use the transform helpers.

Multiple transforms can be applied to any primitive. Transforms combine down the graph to create a very flexible way to manage your scene.

There are a fixed set of transform helpers that create matrices for you.

### Specifying Transforms

You apply transforms to a primitive the same way you specify styles.

``````graph =
Graph.build
|> circle( 100, fill: {:color, :green}, translate: {200, 200} )
|> ellipse( {40, 60, fill: {:color, :red}, rotate: 0.4, translate: {100, 100} )``````

Don't worry about the order you apply transforms to a single object. Scenic will multiply them together in the correct way when it comes time to render them.

# Link to this section Summary

## Functions

Given a Map describing the transforms on a primitive, calculate the combined matrix that should be applied.

# Link to this section Functions

Link to this function

# calculate_local(txs)

View Source

Given a Map describing the transforms on a primitive, calculate the combined matrix that should be applied.

This is trickier than just multiplying them together. Rotations, translations and scale, need to be done in the right order, which is why this function is provided.

You will not normally need to use this function. It is used internally by the input system.

# Link to this section Callbacks

Link to this callback

# info(data)

View Source

## Specs

`info(data :: any()) :: bitstring()`
Link to this callback

# verify(any)

View Source

## Specs

`verify(any()) :: boolean()`