MCPcopy Create free account
hub / github.com/HO-COOH/FastCopy / makeAnimation

Method makeAnimation

FastCopy/TilesControl.cpp:53–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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}

Callers 1

TilesControlMethod · 0.45

Calls 1

BeginMethod · 0.80

Tested by

no test coverage detected