Enable keypads entrance animations

This commit is contained in:
Dr.Rx 2019-05-24 17:00:14 -04:00
commit 5561721675
5 changed files with 111 additions and 21 deletions

View file

@ -497,7 +497,7 @@
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<!--TODO UNO Storyboard.TargetName="NumpadPanel"-->
<DoubleAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
<EasingDoubleKeyFrame KeyTime="0"
@ -517,8 +517,9 @@
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Name="AnimateWithoutResult">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="NumpadPanel"
<Storyboard x:Key="AnimateWithoutResult">
<!--TODO UNO Storyboard.TargetName="NumpadPanel"-->
<DoubleAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
<EasingDoubleKeyFrame KeyTime="0"
Value="0.92">
@ -535,7 +536,8 @@
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="NumpadPanel"
<!--TODO UNO Storyboard.TargetName="NumpadPanel"-->
<DoubleAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
<EasingDoubleKeyFrame KeyTime="0"
Value="0.92">

View file

@ -362,7 +362,51 @@ namespace CalculatorApp
}
// TODO UNO
private Storyboard Animate => (Storyboard)Resources[nameof(Animate)];
private Storyboard _animate;
private Storyboard Animate
{
get
{
if (_animate == null)
{
#if NETFX_CORE
_animate = (Storyboard)Resources[nameof(Animate)];
#else
_animate = StaticResources.Animate;
#endif
foreach (var animation in _animate.Children)
{
Storyboard.SetTarget(animation, NumpadPanel);
}
}
return _animate;
}
}
// TODO UNO
private Storyboard _animateWithoutResult;
private Storyboard AnimateWithoutResult
{
get
{
if (_animateWithoutResult == null)
{
#if NETFX_CORE
_animateWithoutResult = (Storyboard)Resources[nameof(AnimateWithoutResult)];
#else
_animateWithoutResult = StaticResources.AnimateWithoutResult;
#endif
foreach (var animation in _animateWithoutResult.Children)
{
Storyboard.SetTarget(animation, NumpadPanel);
}
}
return _animateWithoutResult;
}
}
// Once the storyboard that rearranges the buttons completed,
// We do the animation based on the Mode or Orientation change.
@ -377,18 +421,11 @@ namespace CalculatorApp
{
m_resultAnimate = false;
// TODO UNO
foreach (var animation in Animate.Children)
{
Storyboard.SetTarget(animation, NumpadPanel);
}
Animate.Begin();
}
else
{
/* UNO TODO */
AnimateWithoutResult?.Begin();
AnimateWithoutResult.Begin();
}
}
}

View file

@ -181,8 +181,7 @@ namespace CalculatorApp
EnsureConverter();
if (!NavCategory.IsConverterViewMode(previousMode))
{
// UNO TODO
// m_converter.AnimateConverter();
m_converter.AnimateConverter();
}
}

View file

@ -233,8 +233,9 @@
<!-- TODO UNO <Setter Property="AutomationProperties.AccessibilityView" Value="Raw"/>-->
</Style>
<Storyboard x:Name="AnimationStory">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ConverterNumPad" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
<Storyboard x:Key="AnimationStory">
<!--TODO UNO Storyboard.TargetName="ConverterNumPad"-->
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
<EasingDoubleKeyFrame KeyTime="0" Value="0.92">
<EasingDoubleKeyFrame.EasingFunction>
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
@ -246,7 +247,8 @@
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ConverterNumPad" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
<!--TODO UNO Storyboard.TargetName="ConverterNumPad"-->
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
<EasingDoubleKeyFrame KeyTime="0" Value="0.92">
<EasingDoubleKeyFrame.EasingFunction>
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
@ -260,10 +262,10 @@
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Name="TimestampFadeInAnimation">
<Storyboard x:Key="TimestampFadeInAnimation">
<!--TODO UNO Storyboard.TargetName="CurrencyTimestampTextBlock"-->
<DoubleAnimation Duration="0:0:1"
From="0"
Storyboard.TargetName="CurrencyTimestampTextBlock"
Storyboard.TargetProperty="Opacity"
To="1"/>
</Storyboard>

View file

@ -19,6 +19,7 @@ using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;
using Calculator;
using CalculatorApp.Common;
@ -273,6 +274,30 @@ namespace CalculatorApp
Model.OnPaste(pastedString, Model.Mode);
}
private Storyboard _animationStory;
private Storyboard AnimationStory
{
get
{
if (_animationStory == null)
{
#if NETFX_CORE
_animationStory = (Storyboard)Resources[nameof(AnimationStory)];
#else
_animationStory = StaticResources.AnimationStory;
#endif
foreach (var animation in _animationStory.Children)
{
Storyboard.SetTarget(animation, ConverterNumPad);
}
}
return _animationStory;
}
}
public void AnimateConverter()
{
if (App.IsAnimationEnabled())
@ -339,6 +364,31 @@ namespace CalculatorApp
}
}
// TODO UNO
private Storyboard _timestampFadeInAnimation;
private Storyboard TimestampFadeInAnimation
{
get
{
if (_timestampFadeInAnimation == null)
{
#if NETFX_CORE
_timestampFadeInAnimation = (Storyboard)Resources[nameof(TimestampFadeInAnimation)];
#else
_timestampFadeInAnimation = StaticResources.TimestampFadeInAnimation;
#endif
foreach (var animation in _timestampFadeInAnimation.Children)
{
Storyboard.SetTarget(animation, CurrencyTimestampTextBlock);
}
}
return _timestampFadeInAnimation;
}
}
void OnIsDisplayVisibleChanged()
{
if (Model.IsCurrencyLoadingVisible)