0

アニメの絵コンテが再生できません。最後の画像のアニメーションのみを表示しました。何が間違っている可能性がありますか?

私のコードはアニメーションを作成します:

public static class AnimationHelper
    {
        private const string PathImageAnimation = "/LeSommet.ZooSnap.UI.WindowsPhone;component/Resources/Images/Animation/ButtonState{0}.png";

        public static void StartAnimation(UIElement target)
        {
            Storyboard storyboard = new Storyboard();

            ObjectAnimationUsingKeyFrames objectAnimation = new ObjectAnimationUsingKeyFrames();
            objectAnimation.AutoReverse = false;
            objectAnimation.SpeedRatio = 2;
            Storyboard.SetTargetProperty(objectAnimation, new PropertyPath("Source"));
            Storyboard.SetTarget(objectAnimation, target);

            for (int i = 1; i <= 4; i++)
            {
                DiscreteObjectKeyFrame discreteObject = new DiscreteObjectKeyFrame()
                {
                    KeyTime = TimeSpan.FromMilliseconds(1000),
                    Value = new BitmapImage(new Uri(string.Format(PathImageAnimation, i), UriKind.Relative))
                };
                objectAnimation.KeyFrames.Add(discreteObject);
            }
            storyboard.Children.Add(objectAnimation);


            storyboard.Begin();
        }
    }

私のコード画像xaml:

<Image Source="/LeSommet.ZooSnap.UI.WindowsPhone;component/Resources/Images/Animation/ButtonState5.png"                            
                           VerticalAlignment="Center"
                           HorizontalAlignment="Center"
                           Width="110" Height="110" Stretch="Fill"
                           x:Name="imageSquareAnimation">
4

1 に答える 1

2

すべてのキーフレームがまったく同時にありますか?

                KeyTime = TimeSpan.FromMilliseconds(1000),

あなたは試すことができます:

                KeyTime = TimeSpan.FromMilliseconds(1000 * i),

Blendの使い方を学んでみてください-アニメーションの作成に役立つ優れたエディターがあります。

于 2012-11-30T08:08:57.827 に答える