11

コントロールが 0.1 から 1.0 (x & y) にスケーリングする基本的なアニメーションを作成しました。私がずっと見ている問題は、最終的な静的状態に落ち着く前に、前述のコントロールのこの「ぼやけ」です。

例は、私が撮ったこのスクリーンカムです。

画面カムを見る

何が原因なのかわかりません。Blend を介して生成するデフォルトのアニメーション/ストーリーボードです。

<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="UIBorder" >
            <EasingDoubleKeyFrame KeyTime="0" Value="0.2">
                <EasingDoubleKeyFrame.EasingFunction>
                    <BackEase EasingMode="EaseInOut"/>
                </EasingDoubleKeyFrame.EasingFunction>
            </EasingDoubleKeyFrame>
            <EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="1">
                <EasingDoubleKeyFrame.EasingFunction>
                    <BackEase EasingMode="EaseInOut" Amplitude="3"/>
                </EasingDoubleKeyFrame.EasingFunction>
            </EasingDoubleKeyFrame>
        </DoubleAnimationUsingKeyFrames>

上記のコントロール:

<Grid x:Name="UIBorder" Width="555"  HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
            <Grid.RenderTransform>
                <CompositeTransform ScaleY="0.2" ScaleX="0.2"/>
            </Grid.RenderTransform>

            <Grid Margin="122,0,0,0" RenderTransformOrigin="0.5,0.5" >
                <Border Background="#FF343434" ManipulationMode="None" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" RenderTransformOrigin="0.5,0.5"  >
                    <Border.RenderTransform>
                        <CompositeTransform/>
                    </Border.RenderTransform>
                </Border>
            </Grid>
            <Image HorizontalAlignment="Left" VerticalAlignment="Center" Source="ms-appx:///Assets/Chrome/LoginSeal.png" Stretch="None"/>
        </Grid>

ノート:

  • このぼやけは、Windows 8 PC と Surface RT タブレットの両方で、2 つの独立したソース (つまり、ハードウェア固有ではない) から確認されました。
  • BitmapCache を試して、変更があったかどうかを確認しました(さらに悪化しました)。
4

2 に答える 2

6

バグのようです。どうやら、WinRT はアニメーション中に CacheMode を BitmapCache に自動的に切り替えており、オブジェクトを低スケールでキャッシュしています。現在表示されているものを再現できませんでしたが、Windows 8 のプレリリース バージョンの 1 つで、TextBlocks のプロジェクション プロパティをアニメーション化するときに同様の問題が発生しました。アニメーションを開始する前に使用されるコントロールの最大サイズを使用して、BitmapCache に使用される RenderAtScale プロパティ値を決定する可能性が高いと思います (これは WinRT では使用できませんが、Silverlight または WPF には存在し、そのバージョンのように見えます)。 API のユーザーに公開されていないだけです)。その場合の 1 つの回避策は、ビットマップの ScaleX/ScaleY 値をロード時に目に見えないように 1 に設定し、ビットマップが最初に表示される前に 0.2 に戻すことです。または、アニメーションの開始前にコントロールの不透明度を 0 に設定し、スケールを 1 に設定し、スケールを 0.2 にアニメートした後にコントロールをフェードインすることもできます。アニメーションの前に小さなものを表示する必要がある場合は、コントロールの 2 つのコピーを作成できます。1 つはアニメーションの開始直後に消える小さなもので、もう 1 つは大きくは見えませんが (または Opacity="0.005" で) 開始されます。 )、アニメーションが開始されると、非常に迅速に不透明度 1、スケール 0.2 にアニメーション化されます。

これは私にはうまく見えました:

<Page
    x:Class="App76.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App76"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Page.Resources>
        <Storyboard
            x:Name="anim"
            SpeedRatio="0.2">
            <DoubleAnimationUsingKeyFrames
                Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)"
                Storyboard.TargetName="UIBorder">
                <EasingDoubleKeyFrame
                    KeyTime="0"
                    Value="0.2">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <BackEase
                            EasingMode="EaseInOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame
                    KeyTime="0:0:1.4"
                    Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <BackEase
                            EasingMode="EaseInOut"
                            Amplitude="3" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames
                Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"
                Storyboard.TargetName="UIBorder">
                <EasingDoubleKeyFrame
                    KeyTime="0"
                    Value="0.2">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <BackEase
                            EasingMode="EaseInOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame
                    KeyTime="0:0:1.4"
                    Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <BackEase
                            EasingMode="EaseInOut"
                            Amplitude="3" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>

        </Storyboard>
    </Page.Resources>
    <Grid
        Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid
            x:Name="UIBorder"
            Width="555"
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            RenderTransformOrigin="0.5,0.5">
            <!--<Grid.CacheMode>
                <BitmapCache
                    />
            </Grid.CacheMode>-->
            <Grid.RenderTransform>
                <CompositeTransform
                    x:Name="ct"
                    ScaleY="0.2"
                    ScaleX="0.2" />
            </Grid.RenderTransform>

            <Grid
                Margin="122,0,0,0"
                RenderTransformOrigin="0.5,0.5">
                <Border
                    Background="#FF343434"
                    ManipulationMode="None"
                    IsDoubleTapEnabled="False"
                    IsHoldingEnabled="False"
                    IsRightTapEnabled="False"
                    IsTapEnabled="False"
                    RenderTransformOrigin="0.5,0.5">
                    <Border.RenderTransform>
                        <CompositeTransform />
                    </Border.RenderTransform>
                </Border>
            </Grid>
            <Image
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                Source="ms-appx:///Assets/SplashScreen.png"
                Stretch="None" />
        </Grid>
        <Button
            VerticalAlignment="Bottom"
            HorizontalAlignment="Left"
            Content="TEST"
            Click="ButtonBase_OnClick" />
    </Grid>
</Page>

using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace App76
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            ct.ScaleX = 1;
            ct.ScaleY = 1;
            this.Loaded += MainPage_Loaded;
        }

        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            ct.ScaleX = 0.2;
            ct.ScaleY = 0.2;
        }

        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            anim.Begin();
        }
    }
}
于 2012-12-14T16:25:38.010 に答える
1

UIBorderにUseLayoutRounding="True"を設定します

于 2012-12-13T23:44:34.527 に答える