| 69 | } |
| 70 | |
| 71 | drape_ptr<SequenceAnimation> GetPrettyFollowAnimation(ScreenBase const & startScreen, m2::PointD const & userPos, |
| 72 | double targetScale, double targetAngle, |
| 73 | m2::PointD const & endPixelPos) |
| 74 | { |
| 75 | auto sequenceAnim = make_unique_dp<SequenceAnimation>(); |
| 76 | sequenceAnim->SetCustomType(kPrettyFollowAnim); |
| 77 | |
| 78 | m2::RectD const viewportRect = startScreen.PixelRectIn3d(); |
| 79 | |
| 80 | ScreenBase tmp = startScreen; |
| 81 | tmp.SetAngle(targetAngle); |
| 82 | tmp.MatchGandP3d(userPos, viewportRect.Center()); |
| 83 | |
| 84 | double const moveDuration = PositionInterpolator::GetMoveDuration(startScreen.GetOrg(), tmp.GetOrg(), startScreen); |
| 85 | ASSERT_GREATER(moveDuration, 0.0, ()); |
| 86 | |
| 87 | double const scaleFactor = moveDuration / kMaxAnimationTimeSec * 2.0; |
| 88 | |
| 89 | tmp = startScreen; |
| 90 | |
| 91 | if (moveDuration > 0.0) |
| 92 | { |
| 93 | tmp.SetScale(startScreen.GetScale() * scaleFactor); |
| 94 | |
| 95 | auto zoomOutAnim = make_unique_dp<MapLinearAnimation>(); |
| 96 | zoomOutAnim->SetScale(startScreen.GetScale(), tmp.GetScale()); |
| 97 | zoomOutAnim->SetMaxDuration(kMaxAnimationTimeSec * 0.5); |
| 98 | sequenceAnim->AddAnimation(std::move(zoomOutAnim)); |
| 99 | |
| 100 | tmp.MatchGandP3d(userPos, viewportRect.Center()); |
| 101 | |
| 102 | auto moveAnim = make_unique_dp<MapLinearAnimation>(); |
| 103 | moveAnim->SetMove(startScreen.GetOrg(), tmp.GetOrg(), viewportRect, tmp.GetScale()); |
| 104 | moveAnim->SetMaxDuration(kMaxAnimationTimeSec); |
| 105 | sequenceAnim->AddAnimation(std::move(moveAnim)); |
| 106 | } |
| 107 | |
| 108 | auto followAnim = |
| 109 | make_unique_dp<MapFollowAnimation>(tmp, userPos, endPixelPos, targetScale, targetAngle, false /* isAutoZoom */); |
| 110 | followAnim->SetMaxDuration(kMaxAnimationTimeSec * 0.5); |
| 111 | sequenceAnim->AddAnimation(std::move(followAnim)); |
| 112 | return sequenceAnim; |
| 113 | } |
| 114 | |
| 115 | drape_ptr<MapLinearAnimation> GetRectAnimation(ScreenBase const & startScreen, ScreenBase const & endScreen) |
| 116 | { |
no test coverage detected