JSDoc: Class: AnimationDirector

# Class: AnimationDirector

## AnimationDirector

AnimationDirector

This object represents an animation director, as the name implies, is an object that manages an animation. Takes the for a plot (mapping file and coordinates) as well as the metadata categories we want to animate over. This object gets called in the main emperor module when an animation starts and an instance will only be alive for one animation cycle i. e. until the cycle hits the final frame of the animation.

## Constructor

#### new AnimationDirector(mappingFileHeaders, mappingFileData, coordinatesData, gradientCategory, trajectoryCategory) → {AnimationDirector}

##### Parameters:

Name | Type | Description
--- | --- | ---
`mappingFileHeaders` | Array.<String> | an Array of strings containing metadata mapping file headers.
`mappingFileData` | Array.<Object> | an Array where the indices are sample identifiers and each of the contained elements is an Array of strings where the first element corresponds to the first data for the first column in the mapping file (mappingFileHeaders).
`coordinatesData` | Array.<Object> | an Array of Objects where the indices are the sample identifiers and each of the objects has the following properties: x, y, z, name, color, P1, P2, P3, ... PN where N is the number of dimensions in this dataset.
`gradientCategory` | String | a string with the name of the mapping file header where the data that spreads the samples over a gradient is contained, usually time or days_since_epoch. Note that this should be an all numeric category.
`trajectoryCategory` | String | a string with the name of the mapping file header where the data that groups the samples is contained, this will usually be BODY_SITE, HOST_SUBJECT_ID, etc..

Source:
  - animate.js, line 50

##### Throws:

Note that this class will raise an Error in any of the following cases:

- One of the input arguments is undefined.
- If gradientCategory is not in the mappingFileHeaders.
- If trajectoryCategory is not in the mappingFileHeaders.

Type
  Error

##### Returns:

returns an animation director if the parameters passed in were all valid.

Type
  AnimationDirector

### Members

#### coordinatesData :Array.<Object>

an Array of Objects where the indices are thesample identifiers and each of the objects has the following properties:x, y, z, name, color, P1, P2, P3, ... PN where N is the number ofdimensions in this dataset.

##### Type:

- Array.<Object>

Source:
  - animate.js, line 95

#### gradientCategory :String

a string with the name of the mapping fileheader where the data that spreads the samples over a gradient iscontained, usually time or days_since_epoch. Note that this should be anall numeric category

##### Type:

- String

Source:
  - animate.js, line 103

#### mappingFileData :Array.<Object>

an Array where the indices are sample identifiersand each of the contained elements is an Array of strings where the firstelement corresponds to the first data for the first column in the mappingfile (mappingFileHeaders).

##### Type:

- Array.<Object>

Source:
  - animate.js, line 87

#### mappingFileHeaders :Array.<String>

mappingFileHeaders an Array of strings containing metadata mapping file headers.

##### Type:

- Array.<String>

Source:
  - animate.js, line 79

#### maximumTrajectoryLength :Integer

Maximum length the groups of samples have along a gradient.

##### Type:

- Integer

Default Value:
  - null
Source:
  - animate.js, line 125

#### minimumDelta :Float

A floating point value determining what the minimum separation betweensamples along the gradients is. Will be null until it is initialized tothe values according to the input data.

##### Type:

- Float

Default Value:
  - null
Source:
  - animate.js, line 119

#### trajectories :Array

Array where each element in the trajectory is a trajectory with theinterpolated points in it.

##### Type:

- Array

Source:
  - animate.js, line 137

#### trajectoryCategory :String

a string with the name of the mapping fileheader where the data that groups the samples is contained, this willusually be BODY_SITE, HOST_SUBJECT_ID, etc..

##### Type:

- String

Source:
  - animate.js, line 110

### Methods

#### animationCycleFinished() → {bool}

Check whether or not the animation cycle has finished for this object.

Source:
  - animate.js, line 271

##### Returns:

True if the animation has reached it's end and False if the animation still has frames to go.

Type
  bool

#### getMaximumTrajectoryLength() → {Integer}

Retrieves the lengths of all the trajectories and figures out which of them is the longest one, then assigns that value to the maximumTrajectoryLength property.

Source:
  - animate.js, line 225

##### Returns:

Maximum trajectory length

Type
  Integer

#### initializeTrajectories()

Initializes the trajectories that the director manages.

Source:
  - animate.js, line 150

#### updateFrame()

Helper method to update the value of the currentFrame property.

Source:
  - animate.js, line 258