Skip to main content

Function: morphMolecule()

morphMolecule(options): Animation

Defined in: src/mobjects/molecular/MorphMolecule.ts:176

Create a MorphMolecule animation.

Over alpha 0 to 1, every atom's position interpolates linearly from its current position to the target, and the bonds rebuild each frame so the sticks follow. With MorphMoleculeOptions.frames the morph plays a trajectory through each frame in order.

Parameters​

options​

MorphMoleculeOptions

The molecule, the target to (or a frames trajectory) and the run time.

Returns​

Animation

An Animation to pass to scene.play.

Throws​

If neither to nor frames is given, if frames is empty, or if any conformation has the wrong length or a non-finite coordinate.