# Align Children

This behavior provides bulk editing of child transforms to create arrangements of objects, useful both for scene setup and animation. It is also a useful behavior for motion graphics with the ability to apply relative offsets, incremental transforms, and adding randomization.&#x20;

{% hint style="success" %}
To add this behavior to an object, right-click the object in the Timeflow view and select from the context menu: Add Tool > Align Children
{% endhint %}

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FEgAFBbI9oDHbdmOZmGlN%2Fimage.png?alt=media&#x26;token=8d3b891f-7f3b-4631-bab5-09ee070e45aa" alt=""><figcaption></figcaption></figure>

## Auto Update

Enable this to automatically update the alignment of children upon any change, and to enable this behavior for animating. If disabled, updates are only applied when the [Refresh ](https://axongenesis.gitbook.io/timeflow/user-guide/timeflow-editor/menu-bar#refresh)button is pressed.

{% hint style="info" %}
When Align Children is only being used for scene setup and not for animation, you may also set the Runtime Mode to [Editor Only](https://axongenesis.gitbook.io/timeflow/user-guide/timeflow-editor/menu-bar#editor-and-runtime-modes), so that the behavior is destroyed and has no effect during runtime.&#x20;
{% endhint %}

## Gather Children

This rebuilds the child object list. Only direct descendants of the current object are considered children. The child objects must remain parented to the current object to behave as expected.

{% hint style="info" %}
Click the Gather Children button any time you have added or removed child objects to refresh the list.
{% endhint %}

{% hint style="danger" %}
Please beware that when using Relative Offsets, as described below, that re-gathering children will reset the original values. This may have unintended consequences so should be used carefully, otherwise you may have to manually reset objects to restore the desired starting position for each object.
{% endhint %}

## Random Seed

Sets the random seed for applying the Randomize values.  Each seed results in the same randomization each time transforms are processed, providing a random but predetermined result.

### Randomize

Click this button to randomly assign a new random seed to quickly create variations.&#x20;

{% hint style="success" %}
**Animating Alignments**

All of the properties listed below may be animated in Timeflow using keyframing or any behavior for dynamic positioning, however Auto Update must be enabled.
{% endhint %}

## Apply Position | Rotation | Scale

Each of the transforms (position, rotation, and scale) have similar settings and generally work in the same manner. You may enable each section as needed. The one key difference is that the scale settings also have a uniform setting, so objects can maintain their proportions.&#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FaUckr8vdYeWhpYwm4umx%2Fimage.png?alt=media&#x26;token=28e6ae7e-486a-429f-9a9f-67abc1a3eebb" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Note that all transforms are applied in local coordinates.
{% endhint %}

## Reverse Order

If this box is checked, the transforms are applied in reverse order, starting with the last child. This has the effect of inverting the applied offset for each, and the randomization values applied. &#x20;

## Relative Offset

When this checkbox is enabled (the default setting) it preserves each child's original local transform as the starting point, when all fields are set to 0. This is especially helpful to deconstruct objects or animate objects already arranged in a specific way.

{% hint style="info" %}
As mentioned above, relative offset values are stored internally when children are first gathered when this component is applied, or whenever Gather Children is pressed. If you need to add children to an existing setup using relative offsets, make sure all fields are set back to zero and that the children appear in the original positions before pressing Gather Children to ensure their relative offsets are based on the correct placement.&#x20;
{% endhint %}

## Center

When enabled, Each is applied so that the objects remain aligned to the center of the parent. This makes it easier to manage columns and rows centered on the parent transform.&#x20;

## Abs

This setting works in conjunction with Center to apply absolute values. Use this to apply symmetrical transforms from the center position.

## (Position | Scale | Rotate) All

This sets the base transform on each object, applying the same value to each.&#x20;

{% hint style="info" %}
Note that this applies to the local transform of each child object, not to the parent. You may still use the standard transforms on the parent object to move the group as a whole.
{% endhint %}

## (Position | Scale | Rotate) Each

This applies incremental transforms to each child in order. This can be used to create stepped or offset transforms that increase or decrease over the list of child objects.

## Randomize

Applies randomization to each transform.&#x20;

## Lock

Each axis can optionally be locked if you wish to constrain alignment to only affect specific axes. This can be useful to prevent accidentally making changes to a certain axis and to allow other behaviors to control them.

## Naming

This is a helpful tool to rename the children with a base name and numbers. This uses the current sorting of children in the hierarchy.

{% hint style="success" %}
**Align Children Example**

Please refer to the example scene provided:

Assets/AxonGenesis/Timeflow/Examples/Scenes/Tools/AlignChildren.unity
{% endhint %}
