■ StringAnimationUsingKeyFrames 엘리먼트 사용하기

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

<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="StringAnimationUsingKeyFrames 엘리먼트 사용하기">

    <Grid TextBlock.FontSize="192">

        <TextBlock Name="textBlock"

            HorizontalAlignment="Center"

            VerticalAlignment="Center"

            Foreground="Black" />

    </Grid>

    <Window.Triggers>

        <EventTrigger RoutedEvent="Canvas.Loaded">

            <BeginStoryboard>

                <Storyboard

                    TargetName="textBlock"

                    Duration="0:0:2"

                    RepeatBehavior="Forever">

                    <StringAnimationUsingKeyFrames Storyboard.TargetProperty="Text">

                        <DiscreteStringKeyFrame KeyTime="0:0:0" Value="EAT" />

                        <DiscreteStringKeyFrame KeyTime="0:0:1" Value="HERE" />

                    </StringAnimationUsingKeyFrames>

                    <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground.Color">

                        <DiscreteColorKeyFrame KeyTime="0:0:0" Value="Red" />

                        <DiscreteColorKeyFrame KeyTime="0:0:1" Value="Blue" />

                    </ColorAnimationUsingKeyFrames>

                </Storyboard>

            </BeginStoryboard>

        </EventTrigger>

    </Window.Triggers>

</Window>

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

Posted by 사용자 icodebroker