Пример #1
0
 public void Reset()
 {
     InitialVelocity = new VectorF(0, 0);
     InitialAngularVelocity = 0;
     InitialExpansionVelocity = 0;
     stopwatch.Reset();
     stopwatch.Start();
 }
Пример #2
0
 //update velocities, velocity = distance/time
 public void Update(ManipulationDeltaEventArgs e, float history)
 {
     float elappsedMS = stopwatch.ElapsedMilliseconds;
     if (elappsedMS == 0)
         elappsedMS = 1;
     InitialVelocity = InitialVelocity * history + ((VectorF)e.TranslationDelta * (1F - history)) / elappsedMS;
     InitialAngularVelocity = InitialAngularVelocity * history + (e.RotationDelta * (1F - history)) / elappsedMS;
     InitialExpansionVelocity = InitialExpansionVelocity * history + (e.ExpansionDelta * (1F - history)) / elappsedMS;
     stopwatch.Reset();
     stopwatch.Start();
 }