# HG changeset patch # User Thinker K.F. Li # Date 1218252112 -28800 # Node ID 83ee36f19210197122c0391ab49064d8bf81d467 # Parent 7d9af44f095b191b3d95afc3e8858f84cc017cf9 - diff -r 7d9af44f095b -r 83ee36f19210 src/animate.c --- a/src/animate.c Sat Aug 09 08:41:13 2008 +0800 +++ b/src/animate.c Sat Aug 09 11:21:52 2008 +0800 @@ -5,6 +5,13 @@ * the order and time of playing of words. A word * defines how long to perform a set of actions. Actions * in a word are performed concurrently. + * + * Animation shapes are updated periodically. Every action + * are working with start, step, and stop 3 calls. start is + * called when start time the word, contain it, due. step is + * called periodically in duration of playing time start at + * 'start time'. When the clock run out the playing time of + * a word, it call stop of actions in the word. */ #include #include @@ -154,17 +161,18 @@ const mb_timeval_t *now, void *arg) { mb_progm_t *progm = (mb_progm_t *)arg; - mb_timeval_t next_tmo, w_stp_tm, diff; + mb_timeval_t next_tmo, w_stp_tm; + mb_timeval_t tmo_diff, next_diff; mb_word_t *word; mb_timer_t *timer; int i; - MB_TIMEVAL_CP(&diff, tmo); - MB_TIMEVAL_DIFF(&diff, &progm->start_time); + MB_TIMEVAL_CP(&tmo_diff, tmo); + MB_TIMEVAL_DIFF(&tmo_diff, &progm->start_time); i = progm->first_playing; for(word = progm->words + i; - i < progm->n_words && MB_TIMEVAL_LATER(&diff, &word->start_time); + i < progm->n_words && MB_TIMEVAL_LATER(&tmo_diff, &word->start_time); word = progm->words + ++i) { MB_TIMEVAL_CP(&w_stp_tm, &progm->start_time); MB_TIMEVAL_ADD(&w_stp_tm, &word->start_time); @@ -182,10 +190,10 @@ MB_TIMEVAL_SET(&next_tmo, 0, STEP_INTERVAL); MB_TIMEVAL_ADD(&next_tmo, tmo); - MB_TIMEVAL_CP(&diff, &next_tmo); - MB_TIMEVAL_DIFF(&diff, &progm->start_time); + MB_TIMEVAL_CP(&next_diff, &next_tmo); + MB_TIMEVAL_DIFF(&next_diff, &progm->start_time); for(word = progm->words + i; - i < progm->n_words && MB_TIMEVAL_LATER(&diff, &word->start_time); + i < progm->n_words && MB_TIMEVAL_LATER(&next_diff, &word->start_time); word = progm->words + ++i) { mb_word_start(word, tmo, now, progm->rdman); }