stagger_animations
This commit is contained in:
parent
89f4ff426b
commit
591a2096b4
|
|
@ -717,6 +717,24 @@ loop_animations(int hierarchy_match_flags) {
|
|||
_anim_controls.loop_all(true);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: WindowFramework::stagger_animations
|
||||
// Access: Public
|
||||
// Description: Walks through all the animations that were bound by
|
||||
// loop_animations() and staggers their play rate
|
||||
// slightly so that they will not remain perfectly in
|
||||
// sync.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void WindowFramework::
|
||||
stagger_animations() {
|
||||
for (int i = 0; i < _anim_controls.get_num_anims(); ++i) {
|
||||
AnimControl *control = _anim_controls.get_anim(i);
|
||||
double r = (double)rand() / (double)RAND_MAX;
|
||||
r = r * 0.2 + 0.9;
|
||||
control->set_play_rate(r);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: WindowFramework::next_anim_control
|
||||
// Access: Public
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ public:
|
|||
void loop_animations(int hierarchy_match_flags =
|
||||
PartGroup::HMF_ok_part_extra |
|
||||
PartGroup::HMF_ok_anim_extra);
|
||||
void stagger_animations();
|
||||
void next_anim_control();
|
||||
void set_anim_controls(bool enable);
|
||||
INLINE bool get_anim_controls() const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue