|
29 | 29 | '逐个进入动画
|
30 | 30 | Dim AniList As New List(Of AniData)
|
31 | 31 | Dim Id As Integer = 0, Delay As Integer = 0
|
32 |
| - Dim Controls = GetAllAnimControls() |
33 |
| - For Each Element As FrameworkElement In Controls |
34 |
| - Element.Opacity = 0 |
35 |
| - Element.RenderTransform = New TranslateTransform(-25, 0) |
36 |
| - AniList.Add(AaOpacity(Element, If(TypeOf Element Is TextBlock, 0.6, 1), 200, Delay, New AniEaseOutFluent(AniEasePower.Weak))) |
37 |
| - AniList.Add(AaTranslateX(Element, 5, 200, Delay, New AniEaseOutFluent)) |
38 |
| - AniList.Add(AaTranslateX(Element, 20, 300, Delay, New AniEaseOutBack(AniEasePower.Weak))) |
39 |
| - If TypeOf Element Is MyListItem Then |
40 |
| - AniList.Add(AaCode(Sub() |
41 |
| - CType(Element, MyListItem).IsMouseOverAnimationEnabled = True |
42 |
| - CType(Element, MyListItem).RefreshColor(Me, New EventArgs) |
43 |
| - End Sub, Delay + 280)) |
| 32 | + For Each Element As FrameworkElement In GetAllAnimControls(True) |
| 33 | + If Element.Visibility = Visibility.Collapsed Then |
| 34 | + '还原之前的隐藏动画可能导致的改变(#2436) |
| 35 | + Element.Opacity = 1 |
| 36 | + Element.RenderTransform = New TranslateTransform(0, 0) |
| 37 | + If TypeOf Element Is MyListItem Then CType(Element, MyListItem).IsMouseOverAnimationEnabled = True |
| 38 | + Else |
| 39 | + Element.Opacity = 0 |
| 40 | + Element.RenderTransform = New TranslateTransform(-25, 0) |
| 41 | + If TypeOf Element Is MyListItem Then CType(Element, MyListItem).IsMouseOverAnimationEnabled = False |
| 42 | + AniList.Add(AaOpacity(Element, If(TypeOf Element Is TextBlock, 0.6, 1), 200, Delay, New AniEaseOutFluent(AniEasePower.Weak))) |
| 43 | + AniList.Add(AaTranslateX(Element, 5, 200, Delay, New AniEaseOutFluent)) |
| 44 | + AniList.Add(AaTranslateX(Element, 20, 300, Delay, New AniEaseOutBack(AniEasePower.Weak))) |
| 45 | + If TypeOf Element Is MyListItem Then |
| 46 | + AniList.Add(AaCode(Sub() |
| 47 | + CType(Element, MyListItem).IsMouseOverAnimationEnabled = True |
| 48 | + CType(Element, MyListItem).RefreshColor(Me, New EventArgs) |
| 49 | + End Sub, Delay + 280)) |
| 50 | + End If |
| 51 | + Delay += Math.Max(8, 20 - Id) * 2.5 |
| 52 | + Id += 1 |
44 | 53 | End If
|
45 |
| - Delay += Math.Max(8, 20 - Id) * 2.5 |
46 |
| - Id += 1 |
47 | 54 | Next
|
48 | 55 | AniStart(AniList, "PageLeft PageChange " & Uuid)
|
49 | 56 | End If
|
|
74 | 81 | End Sub
|
75 | 82 |
|
76 | 83 | '遍历获取所有需要生成动画的控件
|
77 |
| - Private Function GetAllAnimControls() As List(Of FrameworkElement) |
| 84 | + Private Function GetAllAnimControls(Optional IgnoreInvisibility As Boolean = False) As List(Of FrameworkElement) |
78 | 85 | Dim AllControls As New List(Of FrameworkElement)
|
79 |
| - GetAllAnimControls(AnimatedControl, AllControls) |
| 86 | + GetAllAnimControls(AnimatedControl, AllControls, IgnoreInvisibility) |
80 | 87 | Return AllControls
|
81 | 88 | End Function
|
82 |
| - Private Sub GetAllAnimControls(Element As FrameworkElement, ByRef AllControls As List(Of FrameworkElement)) |
83 |
| - If Element.Visibility = Visibility.Collapsed Then Exit Sub |
| 89 | + Private Sub GetAllAnimControls(Element As FrameworkElement, ByRef AllControls As List(Of FrameworkElement), IgnoreInvisibility As Boolean) |
| 90 | + If Not IgnoreInvisibility AndAlso Element.Visibility = Visibility.Collapsed Then Exit Sub |
84 | 91 | If TypeOf Element Is MyTextButton Then
|
85 | 92 | AllControls.Add(Element)
|
86 | 93 | ElseIf TypeOf Element Is MyListItem Then
|
87 |
| - CType(Element, MyListItem).IsMouseOverAnimationEnabled = False |
88 | 94 | AllControls.Add(Element)
|
89 | 95 | ElseIf TypeOf Element Is ContentControl Then
|
90 |
| - GetAllAnimControls(CType(Element, ContentControl).Content, AllControls) |
| 96 | + GetAllAnimControls(CType(Element, ContentControl).Content, AllControls, IgnoreInvisibility) |
91 | 97 | ElseIf TypeOf Element Is Panel Then
|
92 | 98 | For Each Element2 As FrameworkElement In CType(Element, Panel).Children
|
93 |
| - GetAllAnimControls(Element2, AllControls) |
| 99 | + GetAllAnimControls(Element2, AllControls, IgnoreInvisibility) |
94 | 100 | Next
|
95 | 101 | Else
|
96 | 102 | AllControls.Add(Element)
|
|
0 commit comments