コード例 #1
0
 public void BeginAnimation()
 {
     lock (_locker)
     {
         if (State != EAnimatorState.Unstarted && State != EAnimatorState.Suspended)
         {
             throw new InvalidOperationException($"Cannot begin animation because it {State}");
         }
         _startTime = DateTime.UtcNow;
         _vector    = new CVector(From, To);
         _cancellationTokenSource = new CancellationTokenSource();
         CancellationToken token = _cancellationTokenSource.Token;
         _currentTask = new Task(() => DoAnimation(token), token);
         _currentTask.Start();
         State = EAnimatorState.Running;
     }
 }
コード例 #2
0
 public CPoint MovePoint(CVector vector)
 {
     return(new CPoint(X + vector.XProjection, Y + vector.YProjection));
 }