class AnimChannel

The AnimChannel class is the base class for all animation channels in Moho. You never use this class directly, but it provides various functions that are useful for working with any kind of animation channel.

Member Functions

int ChannelType()

Returns the type of animation channel you're working with. See the channel types.

Return value (int): the type of animation channel

int CountKeys()

Returns the number of keyframes in the channel.

Return value (int): the number of keyframes in the channel

int Duration()

Returns the duration of the animation channel (basically, the time of the last keyframe).

Return value (int): the duration of the animation channel

void Clear()

Clears a channel, removing all keyframes.

Return value: none

void StoreValue()

Stores the current value as a keyframe. Each type of channel has a member variable called "value". If you change the value variable then call this function, you will add a new keyframe at the current time.

Return value: none

void AddKey(when)

Adds a new keyframe at the given frame.

Return value: none
when (int): frame number

void Reset(when)

Sets the value at a given frame to be the same as the value at frame 0.

Return value: none
when (int): frame number

bool HasKey(when)

Tests whether the channel has a keyframe at a given frame.

Return value (bool): true if a keyframe exists, otherwise false
when (int): frame number

int GetClosestKeyID(when)

Returns the closest keyframe to the given frame. If the given frame has a key, then that keyframe is returned.

Return value (int): the closest keyframe id
when (int): frame number

void DeleteKey(when)

Deletes a keyframe at the specified frame.

Return value: none
when (int): frame number

void SetKeyInterp(when, interpMode, val1, val2)

Sets the interpolation mode at a specified frame. See the available interpolation mode constants.

Return value: none
when (int): frame number
interpMode (int): interpolation mode
val1 (float): supplemental value 1
val2 (float): supplemental value 2

void SetKeyInterpByID(id, interpMode, val1, val2)

Sets the interpolation mode for a specified keyframe. See the available interpolation mode constants.

Return value: none
id (int): keyframe id
interpMode (int): interpolation mode
val1 (float): supplemental value 1
val2 (float): supplemental value 2
class AnimChannel {
  int32 ChannelType();
 
  int32 CountKeys();
  int32 Duration();
 
  void Clear(int32 zeroFrame);
  void ClearAfter(int32 frame);
  void ClearBefore(int32 frame);
 
  void StoreValue();
  void AddKey(int32 when);
  void Reset(int32 when);
 
  bool HasKey(int32 when);
  int32 GetClosestKeyID(int32 when);
  void DeleteKey(int32 when);
  void DeleteKeyByID(int32 id);
  void SwapKeys(int32 id1, int32 id2);
 
  int32 GetKeyWhen(int32 id);
  void SetKeyWhen(int32 id, int32 when);
  void SetKeyWhenNoRestriction(int32 id, int32 when); // allow keyframes to be set before/after each other, or even on top of each other
  void MakeKeyframesConsistent(bool deleteDuplicates); // make sure the keyframes are all in order according to time, and remove any that overlap
 
  void SetKeyInterp(int32 when, int32 interpMode, real val1, real val2);
  void SetKeyInterpByID(int32 id, int32 interpMode, real val1, real val2);
  void SetKeyInterp(int32 when, InterpSetting &interp);
  void SetKeyInterpByID(int32 id, InterpSetting &interp);
  void GetKeyInterp(int32 when, InterpSetting &interp);
  void GetKeyInterpByID(int32 id, InterpSetting &interp);
  void GetKeyInterp(int32 when, int32 *interpMode, real *val1, real *val2);
  void GetKeyInterpByID(int32 id, int32 *interpMode, real *val1, real *val2);
  int32 GetKeyInterpMode(int32 when);
  int32 GetKeyInterpModeByID(int32 id);
 
  void SetKeySelected(int32 when, bool sel);
  bool IsKeySelected(int32 when);
  void SetKeySelectedByID(int32 id, bool sel);
  bool IsKeySelectedByID(int32 id);
};