# Timeline

For the user interface, see: TimelineUI.

## Notation

Timeline notation contains keyframes which describe a value that changes over time. Timelines usually describe one of: float values, color values, or vector values.

### Keyframe

A timeline keyframe is composed of three elements, separated by colons, and surrounded by square brackets.

```[A:B:C]
```
• Element A is the time index. This parameter ranges from 0 to 1.
• Element B is the value at this keyframe.
• Element C is the interpolation type. This parameter decides how the interpolation from this key to the next key takes place.
• L - Linear
• H - Hold
• I - Ease In
• O - Ease Out
• S - Smooth
• T - Twist

An example keyframe would be:

```[0.5:#0,0,0,1:L]
```

This keyframe has time index == 0.5, a color value of "#0,0,0,1", and an interpolation type of "Linear".

### Timeline

A timeline is composed of several keyframes strung together, followed by a loop type, then a lifetime length.

```[Key][Key] ... [Key]A;B
```
• Element A is the loop type. This parameter decides whether it traverses the timeline once, loops, or ping-pongs. The value is one of:
• O - Once. The timeline runs through once, and thereafter always returns the value of the last keyframe.
• L - Loop. The timeline runs through, and when it reaches the end, snaps to the beginning and continues again.
• P - Ping pong. The timeline runs through, and when it reaches the end, it reverses itself. When it then reaches the beginning, it reverses itself again. Things ping-pongs back and forth between the beginning and the end, smoothly, without snapping.
• Element B is the lifetime duration. This parameter specifies how long the timeline lasts for. If this parameter is 3.0, then it will take 3 seconds to run through the entire timeline once.

An example color timeline might look like:

```[0.0:#0.0,0.0,0.0,1.0:H][0.5:#1.0,1.0,1.0,1.0:L][1.0:#0.0,0.0,0.0,1.0:L]P;1.0
```

This timeline, from time value [0.0,0.5), will return the color #0,0,0,1, due to the hold parameter. At time value 0.5, it will return the color #1,1,1,1. From time value [0.5,1.0] it will linearly interpolate between #1,1,1,1 to #0,0,0,1. It will take 1 second to traverse the entire timeline. When the traversal reaches the end, it is set to ping-pong, so it reverses and repeats the process backwards. When it then reaches the beginning, it reverses again, and repeats the process forwards.