| 51 | } |
| 52 | |
| 53 | void TilesControl::makeAnimation(int previousItemIndex, int currentItemIndex) |
| 54 | { |
| 55 | winrt::Microsoft::UI::Xaml::Media::Animation::Storyboard s; |
| 56 | winrt::Microsoft::UI::Xaml::Media::Animation::DoubleAnimation d[2]; |
| 57 | |
| 58 | auto& previousItemAnimation = d[0]; |
| 59 | auto& currentItemAnimation = d[1]; |
| 60 | |
| 61 | previousItemAnimation.From(-m_renderOffsets[previousItemIndex]); |
| 62 | previousItemAnimation.To(-(m_renderOffsets[previousItemIndex] + ActualHeight())); |
| 63 | previousItemAnimation.Duration({ std::chrono::milliseconds{300}, winrt::Microsoft::UI::Xaml::DurationType::TimeSpan }); |
| 64 | |
| 65 | |
| 66 | currentItemAnimation.From(-(m_renderOffsets[currentItemIndex] - ActualHeight())); |
| 67 | currentItemAnimation.To(-m_renderOffsets[currentItemIndex]); |
| 68 | currentItemAnimation.Duration({ std::chrono::milliseconds{300}, winrt::Microsoft::UI::Xaml::DurationType::TimeSpan }); |
| 69 | |
| 70 | winrt::Microsoft::UI::Xaml::Media::Animation::Storyboard::SetTargetProperty(previousItemAnimation, L"Y"); |
| 71 | winrt::Microsoft::UI::Xaml::Media::Animation::Storyboard::SetTarget(previousItemAnimation, Items().GetAt(previousItemIndex).as<Type>().RenderTransform()); |
| 72 | winrt::Microsoft::UI::Xaml::Media::Animation::Storyboard::SetTargetProperty(currentItemAnimation, L"Y"); |
| 73 | winrt::Microsoft::UI::Xaml::Media::Animation::Storyboard::SetTarget(currentItemAnimation, Items().GetAt(currentItemIndex).as<Type>().RenderTransform()); |
| 74 | |
| 75 | |
| 76 | s.Children().Append(d[0]); |
| 77 | s.Children().Append(d[1]); |
| 78 | s.Begin(); |
| 79 | } |
| 80 | } |