//为了实现移动镜头的效果,开始移动背景 public void MoveBackground() { if (NowCube.RefreshDirection == NextCube.RefreshDirection) { FamilyCanvas.SetValue(Canvas.LeftProperty, LastLeftValue - NextCube.k * (NextCube.dx / CameraMoveFrames)); FamilyCanvas.SetValue(Canvas.TopProperty, LastTopValue + (NextCube.dy / CameraMoveFrames)); } if (NowCube.RefreshDirection != NextCube.RefreshDirection) { FamilyCanvas.SetValue(Canvas.TopProperty, LastTopValue + (NextCube.dy / CameraMoveFrames)); } }
//更新记录每次背景移动后背景Canvas的Position public void UpdataBackgroundLastPosition() { LastLeftValue = (double)FamilyCanvas.GetValue(Canvas.LeftProperty); LastTopValue = (double)FamilyCanvas.GetValue(Canvas.TopProperty); }