mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-23 06:25:19 -07:00
Enable keypads entrance animations
This commit is contained in:
parent
0d942ef6a6
commit
5561721675
5 changed files with 111 additions and 21 deletions
|
@ -497,7 +497,7 @@
|
||||||
</EasingDoubleKeyFrame.EasingFunction>
|
</EasingDoubleKeyFrame.EasingFunction>
|
||||||
</EasingDoubleKeyFrame>
|
</EasingDoubleKeyFrame>
|
||||||
</DoubleAnimationUsingKeyFrames>
|
</DoubleAnimationUsingKeyFrames>
|
||||||
<!--TODO UNO Storyboard.TargetName="NumpadPanel"-->
|
|
||||||
<DoubleAnimationUsingKeyFrames
|
<DoubleAnimationUsingKeyFrames
|
||||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
|
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
|
||||||
<EasingDoubleKeyFrame KeyTime="0"
|
<EasingDoubleKeyFrame KeyTime="0"
|
||||||
|
@ -517,8 +517,9 @@
|
||||||
</DoubleAnimationUsingKeyFrames>
|
</DoubleAnimationUsingKeyFrames>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
|
|
||||||
<Storyboard x:Name="AnimateWithoutResult">
|
<Storyboard x:Key="AnimateWithoutResult">
|
||||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="NumpadPanel"
|
<!--TODO UNO Storyboard.TargetName="NumpadPanel"-->
|
||||||
|
<DoubleAnimationUsingKeyFrames
|
||||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
||||||
<EasingDoubleKeyFrame KeyTime="0"
|
<EasingDoubleKeyFrame KeyTime="0"
|
||||||
Value="0.92">
|
Value="0.92">
|
||||||
|
@ -535,7 +536,8 @@
|
||||||
</EasingDoubleKeyFrame.EasingFunction>
|
</EasingDoubleKeyFrame.EasingFunction>
|
||||||
</EasingDoubleKeyFrame>
|
</EasingDoubleKeyFrame>
|
||||||
</DoubleAnimationUsingKeyFrames>
|
</DoubleAnimationUsingKeyFrames>
|
||||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="NumpadPanel"
|
<!--TODO UNO Storyboard.TargetName="NumpadPanel"-->
|
||||||
|
<DoubleAnimationUsingKeyFrames
|
||||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
|
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
|
||||||
<EasingDoubleKeyFrame KeyTime="0"
|
<EasingDoubleKeyFrame KeyTime="0"
|
||||||
Value="0.92">
|
Value="0.92">
|
||||||
|
|
|
@ -362,7 +362,51 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO UNO
|
// 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,
|
// Once the storyboard that rearranges the buttons completed,
|
||||||
// We do the animation based on the Mode or Orientation change.
|
// We do the animation based on the Mode or Orientation change.
|
||||||
|
@ -377,18 +421,11 @@ namespace CalculatorApp
|
||||||
{
|
{
|
||||||
m_resultAnimate = false;
|
m_resultAnimate = false;
|
||||||
|
|
||||||
// TODO UNO
|
|
||||||
foreach (var animation in Animate.Children)
|
|
||||||
{
|
|
||||||
Storyboard.SetTarget(animation, NumpadPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
Animate.Begin();
|
Animate.Begin();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* UNO TODO */
|
AnimateWithoutResult.Begin();
|
||||||
AnimateWithoutResult?.Begin();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,8 +181,7 @@ namespace CalculatorApp
|
||||||
EnsureConverter();
|
EnsureConverter();
|
||||||
if (!NavCategory.IsConverterViewMode(previousMode))
|
if (!NavCategory.IsConverterViewMode(previousMode))
|
||||||
{
|
{
|
||||||
// UNO TODO
|
m_converter.AnimateConverter();
|
||||||
// m_converter.AnimateConverter();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,8 +233,9 @@
|
||||||
<!-- TODO UNO <Setter Property="AutomationProperties.AccessibilityView" Value="Raw"/>-->
|
<!-- TODO UNO <Setter Property="AutomationProperties.AccessibilityView" Value="Raw"/>-->
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Storyboard x:Name="AnimationStory">
|
<Storyboard x:Key="AnimationStory">
|
||||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ConverterNumPad" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
<!--TODO UNO Storyboard.TargetName="ConverterNumPad"-->
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
|
||||||
<EasingDoubleKeyFrame KeyTime="0" Value="0.92">
|
<EasingDoubleKeyFrame KeyTime="0" Value="0.92">
|
||||||
<EasingDoubleKeyFrame.EasingFunction>
|
<EasingDoubleKeyFrame.EasingFunction>
|
||||||
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
||||||
|
@ -246,7 +247,8 @@
|
||||||
</EasingDoubleKeyFrame.EasingFunction>
|
</EasingDoubleKeyFrame.EasingFunction>
|
||||||
</EasingDoubleKeyFrame>
|
</EasingDoubleKeyFrame>
|
||||||
</DoubleAnimationUsingKeyFrames>
|
</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 KeyTime="0" Value="0.92">
|
||||||
<EasingDoubleKeyFrame.EasingFunction>
|
<EasingDoubleKeyFrame.EasingFunction>
|
||||||
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
<ExponentialEase EasingMode="EaseOut" Exponent="5"/>
|
||||||
|
@ -260,10 +262,10 @@
|
||||||
</DoubleAnimationUsingKeyFrames>
|
</DoubleAnimationUsingKeyFrames>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
|
|
||||||
<Storyboard x:Name="TimestampFadeInAnimation">
|
<Storyboard x:Key="TimestampFadeInAnimation">
|
||||||
|
<!--TODO UNO Storyboard.TargetName="CurrencyTimestampTextBlock"-->
|
||||||
<DoubleAnimation Duration="0:0:1"
|
<DoubleAnimation Duration="0:0:1"
|
||||||
From="0"
|
From="0"
|
||||||
Storyboard.TargetName="CurrencyTimestampTextBlock"
|
|
||||||
Storyboard.TargetProperty="Opacity"
|
Storyboard.TargetProperty="Opacity"
|
||||||
To="1"/>
|
To="1"/>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
|
|
|
@ -19,6 +19,7 @@ using Windows.UI.Xaml.Controls.Primitives;
|
||||||
using Windows.UI.Xaml.Data;
|
using Windows.UI.Xaml.Data;
|
||||||
using Windows.UI.Xaml.Input;
|
using Windows.UI.Xaml.Input;
|
||||||
using Windows.UI.Xaml.Media;
|
using Windows.UI.Xaml.Media;
|
||||||
|
using Windows.UI.Xaml.Media.Animation;
|
||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
using Calculator;
|
using Calculator;
|
||||||
using CalculatorApp.Common;
|
using CalculatorApp.Common;
|
||||||
|
@ -273,6 +274,30 @@ namespace CalculatorApp
|
||||||
Model.OnPaste(pastedString, Model.Mode);
|
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()
|
public void AnimateConverter()
|
||||||
{
|
{
|
||||||
if (App.IsAnimationEnabled())
|
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()
|
void OnIsDisplayVisibleChanged()
|
||||||
{
|
{
|
||||||
if (Model.IsCurrencyLoadingVisible)
|
if (Model.IsCurrencyLoadingVisible)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue