[page:Object3D] →

# [name]

Play a sequence of morphs in a smooth animation sequence.

## Examples

[example:webgl_lights_hemisphere lights / hemisphere ]
[example:webgl_morphtargets_md2 morphtargets / md2 ]
[example:webgl_loader_json_blender loader / json / blender ]
`var meshAnim; loader.load( "models/animated/flamingo.js", function( geometry ) { meshAnim = new THREE.MorphAnimMesh( geometry, material ); meshAnim.duration = 1000; scene.add( meshAnim ); } function update() { var delta = clock.getDelta(); meshAnim.updateAnimation( 1000 * delta ); }`

## Constructor

### [name]([page:Geometry geometry], [page:Material material])

geometry — An instance of [page:Geometry].
material — An instance of [page:Material] (optional).

## Properties

### [property:Boolean directionBackwards]

Animation is playing backwards

### [property:Float direction]

1 if playing forward, -1 if playing backwards

### [property:Integer startKeyframe]

The first keyframe (morph) of the sequence

### [property:Integer endKeyframe]

The last keyframe (morph) of the sequence

### [property:Boolean mirroredLoop]

Loop animation back and forth

### [property:Integer lastKeyframe]

The index of the last keyframe played.

### [property:Integer currentKeyframe]

The index of the current frame being played.

### [property:Integer length]

The number of frames (morphs)

### [property:Float time]

The current playback position of the animation in milliseconds.

### [property:Float duration]

The length of the animation in milliseconds.

## Methods

### [method:null setDirectionForward]()

Sets the animation to play forwards

### [method:null setDirectionBackward]()

Set the animation to play backwards.

### [method:null playAnimation]([page:String label], [page:Float fps])

label -- The label of the animation
fps -- The frames per second (in seconds)
Starts playing a labeled animation. Animations are defined by calling [page:MorphAnimMesh.parseAnimations parseAnimations].

### [method:null setFrameRange]([page:Integer start], [page:Integer end])

start -- The starting frame (morph) index
end -- The ending frame (morph) index
Sets the range of morphs to be played

### [method:null parseAnimations]()

Goes through the geometry's morphTargets and generates animations based on the morphTargets' names (morph.name). Names are of the form "walk_01", "walk_02", "walk_03", etc or "run001", "run002", "run003". The animation label is then the part before the underscore and number, so "walk" or "run" in the examples.
This function changes the underlying geometry object by adding the animations property to it. This property is set to an object of key/pair values, with the key being the label and the value being an object with a start and end property that represents the frame index.

### [method:null updateAnimation]([page:Float delta])

delta -- The change in time in milliseconds
Update the morphTargetInfluences array on the MorphAnimMesh.

### [method:null setAnimationLabel]([page:String label], [page:Integer start], [page:Integer end])

label -- The name of the animation
start -- The starting frame index
end -- The ending frame index
Defines an animation. Sets the geometry.animations[label] to be an object with the start and end properties.

### [method:Object3D clone]([page:Object3D object])

object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned MorphAnimMesh Object.
Clone a MorphAnimMesh Object.

## Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]