31 play(
double from,
double to) {
34 cdata->play(from, to);
36 animation_activated();
55 loop(
bool restart,
double from,
double to) {
58 cdata->loop(restart, from, to);
60 animation_activated();
78 pingpong(
bool restart,
double from,
double to) {
81 cdata->pingpong(restart, from, to);
83 animation_activated();
93 cdata->pose(cdata->get_full_fframe());
108 animation_activated();
119 CDWriter cdata(_cycler);
120 cdata->internal_set_rate(cdata->_frame_rate, play_rate);
128 CDReader cdata(_cycler);
129 return cdata->_play_rate;
139 CDReader cdata(_cycler);
140 return cdata->_frame_rate;
150 if (num_frames <= 0) {
153 CDReader cdata(_cycler);
154 return cmod(cdata->get_full_frame(0), num_frames);
168 if (num_frames <= 0) {
171 CDReader cdata(_cycler);
172 return cmod(cdata->get_full_frame(1), num_frames);
185 CDReader cdata(_cycler);
186 return cdata->get_frac();
201 CDReader cdata(_cycler);
202 return cdata->get_full_frame(0);
219 CDReader cdata(_cycler);
220 return cdata->get_full_fframe();
230 CDReader cdata(_cycler);
231 return cdata->is_playing();
239 INLINE
void AnimInterface::
240 set_frame_rate(
double frame_rate) {
241 CDWriter cdata(_cycler);
242 cdata->internal_set_rate(frame_rate, cdata->_play_rate);
251 INLINE
void AnimInterface::
252 set_num_frames(
int num_frames) {
253 _num_frames = num_frames;
264 INLINE
double AnimInterface::CData::
266 return get_full_fframe() - (double)get_full_frame(0);
269 INLINE std::ostream &
This is the fundamental interface for things that have a play/loop/stop type interface for frame-base...
void pose(double frame)
Sets the animation to the indicated frame and holds it there.
set_play_rate
Changes the rate at which the animation plays.
get_frame
Returns the current integer frame number.
is_playing
Returns true if the animation is currently playing, false if it is stopped (e.g.
get_num_frames
Returns the number of frames in the animation.
get_full_fframe
Returns the current floating-point frame number.
get_play_rate
Returns the rate at which the animation plays.
get_next_frame
Returns the current integer frame number + 1, constrained to the range 0 <= f < get_num_frames().
void stop()
Stops a currently playing or looping animation right where it is.
get_frame_rate
Returns the native frame rate of the animation.
void loop(bool restart)
Starts the entire animation looping.
get_frac
Returns the fractional part of the current frame.
void play()
Runs the entire animation from beginning to end and stops.
get_full_frame
Returns the current integer frame number.
void pingpong(bool restart)
Starts the entire animation bouncing back and forth between its first frame and last frame.
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
float cmod(float x, float y)
This is similar to fmod(), but it behaves properly when x is negative: that is, it always returns a v...