41 play(
double from,
double to) {
44 cdata->play(from, to);
46 animation_activated();
71 loop(
bool restart,
double from,
double to) {
74 cdata->loop(restart, from, to);
76 animation_activated();
104 cdata->pingpong(restart, from, to);
106 animation_activated();
119 cdata->pose(cdata->get_full_fframe());
137 animation_activated();
152 cdata->internal_set_rate(cdata->_frame_rate, play_rate);
164 return cdata->_play_rate;
179 return cdata->_frame_rate;
192 if (num_frames <= 0) {
196 return cmod(cdata->get_full_frame(0), num_frames);
214 if (num_frames <= 0) {
218 return cmod(cdata->get_full_frame(1), num_frames);
235 return cdata->get_frac();
255 return cdata->get_full_frame(0);
277 return cdata->get_full_fframe();
291 return cdata->is_playing();
301 INLINE
void AnimInterface::
302 set_frame_rate(
double frame_rate) {
304 cdata->internal_set_rate(frame_rate, cdata->_play_rate);
316 INLINE
void AnimInterface::
317 set_num_frames(
int num_frames) {
318 _num_frames = num_frames;
332 INLINE
double AnimInterface::CData::
double get_frame_rate() const
Returns the native frame rate of the animation.
int get_full_frame() const
Returns the current integer frame number.
bool is_playing() const
Returns true if the animation is currently playing, false if it is stopped (e.g.
void loop(bool restart)
Starts the entire animation looping.
void pingpong(bool restart)
Starts the entire animation bouncing back and forth between its first frame and last frame...
void stop()
Stops a currently playing or looping animation right where it is.
This is the fundamental interface for things that have a play/loop/stop type interface for frame-base...
void set_play_rate(double play_rate)
Changes the rate at which the animation plays.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
double get_full_fframe() const
Returns the current floating-point frame number.
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
int get_next_frame() const
Returns the current integer frame number + 1, constrained to the range 0 <= f < get_num_frames().
virtual int get_num_frames() const
Returns the number of frames in the animation.
void pose(double frame)
Sets the animation to the indicated frame and holds it there.
double get_play_rate() const
Returns the rate at which the animation plays.
void play()
Runs the entire animation from beginning to end and stops.
int get_frame() const
Returns the current integer frame number.
double get_frac() const
Returns the fractional part of the current frame.