AnimInterface

from panda3d.core import AnimInterface
class AnimInterface

Bases: DTOOL_SUPER_BASE

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 diagram

Inheritance diagram of AnimInterface

PMLoop = 2
PMPingpong = 3
PMPlay = 1
PMPose = 0
PM_loop = 2
PM_pingpong = 3
PM_play = 1
PM_pose = 0
__init__(*args, **kwargs)
frac
frame
frame_rate
full_fframe
full_frame
getClassType()

C++ Interface: get_class_type()

getFrac()

C++ Interface: get_frac(AnimInterface self)

/**
  • 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()

C++ Interface: get_frame(AnimInterface self)

/**
  • Returns the current integer frame number. This number will be in the range

  • 0 <= f < get_num_frames().

*/

getFrameRate()

C++ Interface: get_frame_rate(AnimInterface self)

/**
  • 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()

C++ Interface: get_full_fframe(AnimInterface self)

/**
  • 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()

C++ Interface: get_full_frame(AnimInterface self)

/**
  • 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()

C++ Interface: get_next_frame(AnimInterface self)

/**
  • 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()

C++ Interface: get_num_frames(AnimInterface self)

/**
  • 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).

*/

getPlayMode()

C++ Interface: get_play_mode(AnimInterface self)

/**
  • Returns the current play mode of the animation; whether the animation is

  • playing normally, looping, posing, or in ping-pong mode.

*/

getPlayRate()

C++ Interface: get_play_rate(AnimInterface self)

/**
  • Returns the rate at which the animation plays. See set_play_rate().

*/

get_class_type()

C++ Interface: get_class_type()

get_frac()

C++ Interface: get_frac(AnimInterface self)

/**
  • 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().

*/

get_frame()

C++ Interface: get_frame(AnimInterface self)

/**
  • Returns the current integer frame number. This number will be in the range

  • 0 <= f < get_num_frames().

*/

get_frame_rate()

C++ Interface: get_frame_rate(AnimInterface self)

/**
  • 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.

*/

get_full_fframe()

C++ Interface: get_full_fframe(AnimInterface self)

/**
  • 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).

*/

get_full_frame()

C++ Interface: get_full_frame(AnimInterface self)

/**
  • 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.

*/

get_next_frame()

C++ Interface: get_next_frame(AnimInterface self)

/**
  • 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.

*/

get_num_frames()

C++ Interface: get_num_frames(AnimInterface self)

/**
  • 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).

*/

get_play_mode()

C++ Interface: get_play_mode(AnimInterface self)

/**
  • Returns the current play mode of the animation; whether the animation is

  • playing normally, looping, posing, or in ping-pong mode.

*/

get_play_rate()

C++ Interface: get_play_rate(AnimInterface self)

/**
  • Returns the rate at which the animation plays. See set_play_rate().

*/

isPlaying()

C++ Interface: is_playing(AnimInterface self)

/**
  • 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).

*/

is_playing()

C++ Interface: is_playing(AnimInterface self)

/**
  • 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()

C++ Interface: loop(const AnimInterface self, bool restart) loop(const AnimInterface self, bool restart, double from, double to)

/**
  • Starts the entire animation looping. If restart is true, the animation is

  • restarted from the beginning; otherwise, it continues from the current

  • frame.

*/

/**
  • 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.

*/

next_frame
num_frames
output()

C++ Interface: output(AnimInterface self, ostream out)

/**

*/

pingpong()

C++ Interface: pingpong(const AnimInterface self, bool restart) pingpong(const AnimInterface self, bool restart, double from, double to)

/**
  • 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.

*/

/**
  • Loops the animation from the frame “from” to and including the frame “to”,

  • and then back in the opposite direction, indefinitely.

*/

play()

C++ Interface: play(const AnimInterface self) play(const AnimInterface self, double from, double to)

/**
  • Runs the entire animation from beginning to end and stops.

*/

/**
  • 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.

*/

play_mode
play_rate
playing
pose()

C++ Interface: pose(const AnimInterface self, double frame)

/**
  • Sets the animation to the indicated frame and holds it there.

*/

setPlayRate()

C++ Interface: set_play_rate(const AnimInterface self, double play_rate)

/**
  • 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.

*/

set_play_rate()

C++ Interface: set_play_rate(const AnimInterface self, double play_rate)

/**
  • 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()

C++ Interface: stop(const AnimInterface self)

/**
  • Stops a currently playing or looping animation right where it is. The

  • animation remains posed at the current frame.

*/