# AnimInterface

from pandac.PandaModules import AnimInterface

Class : AnimInterface
Description : This is the fundamental interface for things that have a play/loop/stop type interface for frame-based animation, such as animated characters. This is the base class for AnimControl and other, similar classes.

## Inheritance:

AnimInterface:

## Methods of AnimInterface:

getClassType
getFrac
getFrame
getFrameRate
getFullFframe
getFullFrame
getNextFrame
getNumFrames
getPlayRate
isPlaying
loop
output
pingpong
play
pose
setPlayRate
stop

getClassType static TypeHandle AnimInterface::get_class_type(void); Undocumented function.

getFrac double AnimInterface::get_frac(void) const; Description: Returns the fractional part of the current frame. Normally, this is in the range 0.0 <= f < 1.0, but in the one special case of an animation playing to its end frame and stopping, it might exactly equal 1.0. It will always be true that get_full_frame() + get_frac() == get_full_fframe().

getFrame int AnimInterface::get_frame(void) const; Description: Returns the current integer frame number. This number will be in the range 0 <= f < get_num_frames().

getFrameRate double AnimInterface::get_frame_rate(void) const; Description: Returns the native frame rate of the animation. This is the number of frames per second that will elapse when the play_rate is set to 1.0. It is a fixed property of the animation and may not be adjusted by the user.

getFullFframe double AnimInterface::get_full_fframe(void) const; Description: Returns the current floating-point frame number. Unlike the value returned by get_frame(), this frame number may extend beyond the range of get_num_frames() if the frame range passed to play(), loop(), etc. did. Unlike the value returned by get_full_frame(), this return value may equal (to_frame + 1.0), when the animation has played to its natural end. However, in this case the return value of get_full_frame() will be to_frame, not (to_frame + 1).

getFullFrame int AnimInterface::get_full_frame(void) const; Description: Returns the current integer frame number. Unlike the value returned by get_frame(), this frame number may extend beyond the range of get_num_frames() if the frame range passed to play(), loop(), etc. did. Unlike the value returned by get_full_fframe(), this return value will never exceed the value passed to to_frame in the play() method.

getNextFrame int AnimInterface::get_next_frame(void) const; Description: Returns the current integer frame number + 1, constrained to the range 0 <= f < get_num_frames(). If the play mode is PM_play, this will clamp to the same value as get_frame() at the end of the animation. If the play mode is any other value, this will wrap around to frame 0 at the end of the animation.

getNumFrames virtual int AnimInterface::get_num_frames(void) const; Description: Returns the number of frames in the animation. This is a property of the animation and may not be directly adjusted by the user (although it may change without warning with certain kinds of animations, since this is a virtual method that may be overridden).

getPlayRate double AnimInterface::get_play_rate(void) const; Description: Returns the rate at which the animation plays. See set_play_rate().

isPlaying bool AnimInterface::is_playing(void) const; Description: Returns true if the animation is currently playing, false if it is stopped (e.g. because stop() or pose() was called, or because it reached the end of the animation after play() was called).

loop void AnimInterface::loop(bool restart); Description: Starts the entire animation looping. If restart is true, the animation is restarted from the beginning; otherwise, it continues from the current frame. Description: Loops the animation from the frame "from" to and including the frame "to", indefinitely. If restart is true, the animation is restarted from the beginning; otherwise, it continues from the current frame.

output virtual void AnimInterface::output(ostream &out) const; Description:

pingpong void AnimInterface::pingpong(bool restart); Description: Starts the entire animation bouncing back and forth between its first frame and last frame. If restart is true, the animation is restarted from the beginning; otherwise, it continues from the current frame. Description: Loops the animation from the frame "from" to and including the frame "to", and then back in the opposite direction, indefinitely.

play void AnimInterface::play(void); Filename: animInterface.I Created by: drose (20Sep05) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Runs the entire animation from beginning to end and stops. Description: Runs the animation from the frame "from" to and including the frame "to", at which point the animation is stopped. Both "from" and "to" frame numbers may be outside the range (0, get_num_frames()) and the animation will follow the range correctly, reporting numbers modulo get_num_frames(). For instance, play(0, get_num_frames() * 2) will play the animation twice and then stop.

pose void AnimInterface::pose(double frame); Description: Sets the animation to the indicated frame and holds it there.

setPlayRate void AnimInterface::set_play_rate(double play_rate); Description: Changes the rate at which the animation plays. 1.0 is the normal speed, 2.0 is twice normal speed, and 0.5 is half normal speed. 0.0 is legal to pause the animation, and a negative value will play the animation backwards.

stop void AnimInterface::stop(void); Description: Stops a currently playing or looping animation right where it is. The animation remains posed at the current frame.