Blog Content

    티스토리 뷰

    71.SilverLight3 - ColorAnimation

    반응형
    ColorAnimation
    - 색상을 변경하는 애니메이션

    MainPage.xaml

    [그림 71-1]


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

        <!--[1] -->

        <Grid.Triggers>

            <EventTrigger RoutedEvent="Grid.Loaded">

                <BeginStoryboard>

                    <Storyboard>

                        <ColorAnimation

                            Storyboard.TargetName="myRect"

                            Storyboard.TargetProperty="

                                (Rectangle.Fill).(SolidColorBrush.Color)"

                            Duration="0.0:0:5.0"

                            From="DodgerBlue"

                            To="Silver"

                            AutoReverse="True"

                            RepeatBehavior="Forever"></ColorAnimation>

                    </Storyboard>

                </BeginStoryboard>

            </EventTrigger>

        </Grid.Triggers>

        <!--[2] -->

        <StackPanel>

            <Rectangle x:Name="myRect" Width="100" Height="100" Fill="DodgerBlue"

                       Margin="10" Stroke="Silver" StrokeThickness="2"

                       RadiusX="10" RadiusY="10"></Rectangle>

        </StackPanel>

    </Grid>


    결과화면

    [그림 71-2]



    반응형

    'Silverlight' 카테고리의 다른 글

    73.SilverLight3 - LinearKeyFrame  (0) 2009.12.04
    72.SilverLight3 - TimeLine  (0) 2009.12.03
    70.SilverLight3 - PointAnimation  (0) 2009.12.03
    69.SilverLight3 - DoubleAnimation  (0) 2009.12.03
    68.SilverLight3 - Template  (0) 2009.12.03

    Comments