# Converting animation key values between Houdini and Maya

Houdini stores key tangents using second-based “slope” and “acceleration”, while Maya uses frame-based “angle” and “weight”. This page shows how to convert between the two.

## Overview ¶

Maya’s animation key tangent parameters are based on frames while Houdini’s are based on seconds instead. Except for this difference, Maya’s tangent “angle” corresponds to Houdini’s “slope” while Maya’s tangent “weight” corresponds to Houdini’s “acceleration”. In both cases, the units for a key’s “value” are the same.

The formulas below show how to convert between Maya’s angle/weight and Houdini’s slope/acceleration parameters for `bezier()` expression keys, which correspond to Maya weighted tangent keys. For Houdini cubic() expression keys (which only uses slope values), these should be converted to Maya non-weighted tangent keys.

Variable

Meaning

`V`

Key’s value.

`F`

Frame containing key in Maya.

`Angle`

Maya animation key parameter.

`Weight`

Maya animation key parameter.

`FPS`

Frame rate (frames per second) in Maya.

`S`

Houdini key “slope” parameter.

`A`

Houdini key “acceleration” parameter.

`DT`, `DF`

An arbitrary time delta where DT is in seconds while DF is in frames.

`DV`

An arbitrary value delta.

## Maya to Houdini ¶

Although we're using Maya as an example, the formulas below apply to any animation software that expresses their key tangent parameters in frames instead of seconds. Houdini’s animation keys are expressed in seconds so that they are independent of the scene’s frame rate.

The formulas below assume that the converted values are put into Houdini keys using the `bezier()` expression which corresponds to Maya’s weighted tangent keys. For Maya’s non-weighted tangent keys, these correspond to Houdini `cubic()` expression keys, which only uses slope values.

### Angle to slope ¶

Given:

```DF = FPS * DT                                  (1)
tan(Angle) = DV / DF                           (2)
S = DV / DT                                    (3)```

We can derive the formula for slope by rearranging these and substituting:

```S = DV / DT                                    (3)
= (DF * tan(Angle)) / (DF / FPS)             (from 2 and 1 respectively)
= (DF * tan(Angle)) * (FPS / DF)
= FPS * tan(Angle)                           (4)```

The final formula for slope is:

`S = FPS * tan(Angle)`

### Weight to acceleration ¶

Given:

```DF = FPS * DT                                  (1)
tan(Angle) = DV / DF                           (2)
tan(Angle) = S / FPS                           (5, from 4 above)
Weight^2 = DF^2 + DV^2                         (6)
A^2 = DT^2 + DV^2                              (7)```

We can derive the formula for acceleration by rearranging these and substituting:

```DV^2 / DF^2 = S^2 / FPS^2                      (8, from 2 and 5)

Weight^2 / DF^2 = 1 + DV^2 / DF^2              (6 divided by DF^2)
= 1 + S^2 / FPS^2              (from 8)
= (FPS^2 + S^2) / FPS^2
==> DF^2 = (Weight^2 * FPS^2) / (S^2 + FPS^2)  (9)

A^2 / DF^2 = DT^2 / DF^2 + DV^2 / DF^2         (7 divided by DF^2)
= 1 / FPS^2 + DV^2 / DF^2           (from 1, since DT^2 = DF^2 / FPS^2)
= 1 / FPS^2 + S^2 / FPS^2           (from 8)
= (S^2 + 1) / FPS^2
==> A^2 = DF^2 * (S^2 + 1) / FPS^2
= ((Weight^2 * FPS^2) * (S^2 + 1)) / ((S^2 + FPS^2) * FPS^2)  (from 9)
= (Weight^2 * (S^2 + 1)) / (S^2 + FPS^2)
==>   A = sqrt( (Weight^2 * (S^2 + 1)) / (S^2 + FPS^2) )              (10)```

The final formula for acceleration is:

`A = sqrt( (Weight^2 * (S^2 + 1)) / (S^2 + FPS^2) )`

## Houdini to Maya ¶

### Slope to angle ¶

We can convert slope to angle by rearranging the slope (S) formula from above to get:

`Angle = atan2(S, FPS)`

### Acceleration to weight ¶

We can re-arrange the acceleration (A) formula from above to get:

`Weight = sqrt( (A^2 * (S^2 + FPS^2)) / (S^2 + 1) )`