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);
126 INLINE
double AnimInterface::
127 get_play_rate()
const {
128 CDReader cdata(_cycler);
129 return cdata->_play_rate;
137 INLINE
double AnimInterface::
138 get_frame_rate()
const {
139 CDReader cdata(_cycler);
140 return cdata->_frame_rate;
147 INLINE
int AnimInterface::
150 if (num_frames <= 0) {
153 CDReader cdata(_cycler);
154 return cmod(cdata->get_full_frame(0), num_frames);
165 INLINE
int AnimInterface::
166 get_next_frame()
const {
168 if (num_frames <= 0) {
171 CDReader cdata(_cycler);
172 return cmod(cdata->get_full_frame(1), num_frames);
183 INLINE
double AnimInterface::
185 CDReader cdata(_cycler);
186 return cdata->get_frac();
199 INLINE
int AnimInterface::
200 get_full_frame()
const {
201 CDReader cdata(_cycler);
202 return cdata->get_full_frame(0);
217 INLINE
double AnimInterface::
218 get_full_fframe()
const {
219 CDReader cdata(_cycler);
220 return cdata->get_full_fframe();
228 INLINE
bool AnimInterface::
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 &
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...
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...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
get_num_frames
Returns the number of frames in the animation.
void pose(double frame)
Sets the animation to the indicated frame and holds it there.
void play()
Runs the entire animation from beginning to end and stops.
set_play_rate
Changes the rate at which the animation plays.