■ DoubleAnimationUsingKeyFrames 엘리먼트 사용하기

----------------------------------------------------------------------------------------------------

 

 

<Window

    x:Class="TestProject.MainWindow"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:s="clr-namespace:System;assembly=mscorlib"

    Width="600"

    Height="450"

    Title="DoubleAnimationUsingKeyFrames 엘리먼트 사용하기">

    <Grid TextBlock.FontSize="192">

        <TextBlock Name="eatTextBlock"

            HorizontalAlignment="Center"

            VerticalAlignment="Center"

            Foreground="Red"

            Text="EAT" />

        <TextBlock Name="hereTextBlock"

            HorizontalAlignment="Center"

            VerticalAlignment="Center"

            Foreground="Blue"

            Opacity="0"

            Text="HERE" />

    </Grid>

    <Window.Triggers>

        <EventTrigger RoutedEvent="Canvas.Loaded">

            <BeginStoryboard>

                <Storyboard

                    TargetProperty="Opacity"

                    RepeatBehavior="Forever">

                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="eatTextBlock">

                        <DiscreteDoubleKeyFrame KeyTime="0:0:1" Value="0" />

                        <DiscreteDoubleKeyFrame KeyTime="0:0:2" Value="1" />

                    </DoubleAnimationUsingKeyFrames>

                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="hereTextBlock">

                        <DiscreteDoubleKeyFrame KeyTime="0:0:1" Value="1" />

                        <DiscreteDoubleKeyFrame KeyTime="0:0:2" Value="0" />

                    </DoubleAnimationUsingKeyFrames>

                </Storyboard>

            </BeginStoryboard>

        </EventTrigger>

    </Window.Triggers>

</Window>

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker