Frederic Bouvier:

I modified the included animation.cxx to have a randomly displaced
time origin, to break the unison. And the flashing period is also
random as you noticed. I also put all the flashing light of the pole
in the same animation so they flash in the same rhythm.
This commit is contained in:
curt
2004-05-10 20:27:30 +00:00
parent 2866d1ace9
commit a9faf8ceff

View File

@@ -420,12 +420,26 @@ SGSpinAnimation::update()
SGTimedAnimation::SGTimedAnimation (SGPropertyNode_ptr props)
: SGAnimation(props, new ssgSelector),
_use_personality( props->getBoolValue("use-personality",false) ),
_duration_sec(props->getDoubleValue("duration-sec", 1.0)),
_last_time_sec( sim_time_sec ),
_total_duration_sec( 0 ),
_step( 0 )
{
SGPropertyNode_ptr dNode = props->getChild( "duration-sec" );
if ( dNode == 0 ) {
_duration_sec = 1.0;
} else {
SGPropertyNode_ptr rNode = dNode->getChild("random");
if ( rNode == 0 ) {
_duration_sec = dNode->getDoubleValue();
} else {
double dmin = rNode->getDoubleValue( "min", 0.0 ),
dmax = rNode->getDoubleValue( "max", 1.0 );
_duration_sec = dmin + sg_random() * ( dmax - dmin );
}
}
_last_time_sec = sim_time_sec - _duration_sec;
vector<SGPropertyNode_ptr> nodes = props->getChildren( "branch-duration-sec" );
size_t nb = nodes.size();
for ( size_t i = 0; i < nb; i++ ) {