1

下のリンクのサンプルのように、投影反転アニメーションのように画像を連続的に表示する必要があります。

http://www.silverlightbuzz.com/2009/10/14/using-the-3d-tools-to-animate-in-blend/

上記のサンプルの 2 番目のアニメーションを実装する方法。上記のリンクで見ることができるアニメーションには 2 種類あります。そのような Windows 8 で 2 番目のアニメーションを実装する方法 System.Windows.Interactivity and Microsoft.Expression.Interactionsdll は Windows 8 では役に立ちません。次に、Windows 8 でこのアニメーションを実行する方法を教えてください。

編集:

<UserControl.Resources>
        <Storyboard x:Name="Storyboard1" RepeatBehavior="Forever">
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:01.5000000" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:02" Value="90"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle1" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="-90"/>
                <EasingDoubleKeyFrame KeyTime="00:00:02" Value="-90"/>
                <EasingDoubleKeyFrame KeyTime="00:00:02.5000000" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:03.5000000" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle1" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
                <EasingDoubleKeyFrame KeyTime="00:00:03.5000000" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="00:00:04" Value="90"/>
            </DoubleAnimationUsingKeyFrames>

            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)">
                <EasingDoubleKeyFrame KeyTime="00:00:00" Value="-90"/>
                <EasingDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0"/>
            </DoubleAnimationUsingKeyFrames>

        </Storyboard>
    </UserControl.Resources>

<Grid x:Name="LayoutRoot" Background="Black">


            <Rectangle x:Name="rectangle1" RadiusX="12" RadiusY="12" Height="300" HorizontalAlignment="Center" VerticalAlignment="Center" Width="300">
                <Rectangle.Projection>
                    <PlaneProjection RotationX="-90"/>
                </Rectangle.Projection>
                <Rectangle.Fill>
                    <ImageBrush ImageSource="/Assets/7.png"/>
                </Rectangle.Fill>
            </Rectangle>
            <Rectangle x:Name="rectangle" RadiusX="12" RadiusY="12" Height="300" HorizontalAlignment="Center" VerticalAlignment="Center" Width="300">
                <Rectangle.Projection>
                    <PlaneProjection RotationX="-90"/>
                </Rectangle.Projection>
                <Rectangle.Fill>
                    <ImageBrush ImageSource="/Assets/8.png"/>
                </Rectangle.Fill>
            </Rectangle>




        <Button x:Name="StartAnimation" 
                Content="Start Animation"

                Grid.Row="1" 
                Width="163"
                Height="61" Margin="0,65,0,24" Click="StartAnimation_Click" />

    </Grid>
4

1 に答える 1

1

従うべきリンク ..アニメーションのストーリーボードを作成する方法を教えてくれます..ストーリーボードをblendに保存すると、ストーリーボードが自動的にpage.resourcesセクションに表示され、コードビハインドで好きな場所から開始できます..ちょうどいい'' StoryboardName.begin();

私はあなたにこのリンクを提供しています.UIの使用が必要なため、すべての情報を段階的に提供することは非常に困難です..これがあなたに役立つことを願っています..

わかりました、私はあなたを助けるかもしれない何かをしました..私はコードを介していつでも変更できるプロパティにあなたの長方形の塗りつぶしをバインドしたように.ディスパッチャタイマーを使用することができ、一定の間隔の後にあなたの長方形の画像を変更することができますこれ..

<Rectangle x:Name="rectangle1" RadiusX="12" RadiusY="12" Height="300" HorizontalAlignment="Center" VerticalAlignment="Center" Width="300">
        <Rectangle.Projection>
            <PlaneProjection RotationX="-90"/>
        </Rectangle.Projection>
        <Rectangle.Fill>
            <ImageBrush ImageSource="{Binding hello1}"/>
        </Rectangle.Fill>
    </Rectangle>

あなたのページで.csこれを行います..

public sealed partial class MainPage : Page , INotifyPropertyChanged
{


    public MainPage()
    {
        this.InitializeComponent();
        DispatcherTimerSetup();
     //   hello1 = "/Assets/4.jpeg";
         hello1 = new ImageBrush();
        hello1.ImageSource =
            new BitmapImage(
                new Uri(BaseUri, "Assets/1.jpg")
            );

        this.DataContext = this;

    }

    DispatcherTimer dispatcherTimer;
    DateTimeOffset startTime;
    DateTimeOffset lastTime;
    DateTimeOffset stopTime;
    int timesTicked = 1;
    int timesToTick = 10;

    public void DispatcherTimerSetup()
    {
        dispatcherTimer = new DispatcherTimer();
        dispatcherTimer.Tick += dispatcherTimer_Tick;
        dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
        //IsEnabled defaults to false
  //      TimerLog.Text += "dispatcherTimer.IsEnabled = " + dispatcherTimer.IsEnabled + "\n";
        startTime = DateTimeOffset.Now;
        lastTime = startTime;
    //    TimerLog.Text += "Calling dispatcherTimer.Start()\n";
        dispatcherTimer.Start();
        //IsEnabled should now be true after calling start
      //  TimerLog.Text += "dispatcherTimer.IsEnabled = " + dispatcherTimer.IsEnabled + "\n";
    }

    void dispatcherTimer_Tick(object sender, object e)
    {
        rectangle.Fill = hello1;
    }


    private ImageBrush hello;
    public ImageBrush hello1
    {
        get
        {
            return hello;
        }
        set
        {
            hello = value;
            FirePropertyChanged("hello1");
        }
    }


    /// <summary>
    /// Invoked when this page is about to be displayed in a Frame.
    /// </summary>
    /// <param name="e">Event data that describes how this page was reached.  The Parameter
    /// property is typically used to configure the page.</param>


    private void StartAnimation_Click_1(object sender, RoutedEventArgs e)
    {
        Storyboard1.Begin();
      //  Storyboard1.GetCurrentTime =
      //  Storyboard1.
      //  double sd = Storyboard1.GetCurrentTime;

    }


    public event PropertyChangedEventHandler PropertyChanged;
    protected void FirePropertyChanged(string propertyName)
    {
        if (this.PropertyChanged != null)
        {
            this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }

}

必要に応じて変更できます..これがお役に立てば幸いです..

于 2013-07-16T07:02:34.790 に答える