strana 215
----------
<Storyboard x:Name="sbPohyb">
  <PointAnimation 
    Storyboard.TargetName="Kruh"
    Storyboard.TargetProperty="Center" 
    From="50,50" To="400,200" 
    Duration="0:0:5"
    AutoReverse="True" 
    RepeatBehavior="Forever" />
</Storyboard>


<Canvas x:Name="LayoutRoot" Background="White">
  <Canvas.Resources>
    <Storyboard x:Name="sbPohyb">
      <PointAnimation Storyboard.TargetName="Kruh"
        Storyboard.TargetProperty="Center" 
        From="50,50" To="400,200" Duration="0:0:5"
        AutoReverse="True" RepeatBehavior="Forever" />
    </Storyboard>
  </Canvas.Resources>
  <Path Fill="Blue">
    <Path.Data>
      <EllipseGeometry x:Name="Kruh"Center="50,50" 
        RadiusX="30" RadiusY="30" />
    </Path.Data>
  </Path>
</Canvas>


C#:
public partial class MainControl : UserControl
{
  public MainControl()
  {
    InitializeComponent();
    sbPohyb.Begin();
  }
}



strana 216
----------
<StackPanel Orientation="Horizontal" Canvas.Left="10" Canvas.Top="265">
  <Button Click="Animation_Begin"
    Width="65" Height="30" Margin="2" Content="Begin" />

  <Button Click="Animation_Pause"
    Width="65" Height="30" Margin="2" Content="Pause" />

  <Button Click="Animation_Resume"
    Width="65" Height="30" Margin="2" Content="Resume" />

  <Button Click="Animation_Stop"
    Width="65" Height="30" Margin="2" Content="Stop" />
</StackPanel>



strana 217
----------
C#:
private void Animation_Begin(object sender, RoutedEventArgs e)
{
  sbPohyb.Begin();
}

private void Animation_Pause(object sender, RoutedEventArgs e)
{
  sbPohyb.Pause(); 
}

private void Animation_Resume(object sender, RoutedEventArgs e)
{
  sbPohyb.Resume();
}

private void Animation_Stop(object sender, RoutedEventArgs e)
{
  sbPohyb.Stop();
}




strana 219
----------
<Canvas x:Name="LayoutRoot" Background="White">
  <Canvas.Resources>
    <Storyboard x:Name="sbPohyb">
      <DoubleAnimation
        Storyboard.TargetName="Obdelnik"
        Storyboard.TargetProperty="Opacity"
        From="1.0" To="0.0" Duration="0:0:3" 
        AutoReverse="True" RepeatBehavior="Forever" />
    </Storyboard>
  </Canvas.Resources>
  <Rectangle x:Name="Obdlznik" Width="150" Height="100" Fill="Blue" />
</Canvas>


C#:
public partial class MainControl : UserControl
{
  public MainControl()
  {
    InitializeComponent();
    sbPohyb.Begin();
  }
}



<StackPanel x:Name="LayoutRoot" >
  <StackPanel.Resources>
    <Storyboard x:Name="sbAnimace">
      <ColorAnimation Storyboard.TargetName="caBarva"
        Storyboard.TargetProperty="Color" 
        From="Blue" To="Yellow" Duration="0:0:5" />
    </Storyboard>
  </StackPanel.Resources>

  <StackPanel.Background>
    <SolidColorBrush x:Name="caBarvaa" Color="Blue" />
  </StackPanel.Background>
</StackPanel>


strana 220
----------
<Canvas x:Name="LayoutRoot" Background="White">
  <Canvas.Resources>
    <Storyboard x:Name="sb1"  Completed="sb1_Completed">
      <DoubleAnimation Storyboard.TargetName="Obdelnik"
        Storyboard.TargetProperty="(Canvas.Left)"
        From="100" To="500" Duration="0:0:2" />
    </Storyboard>

    <Storyboard x:Name="sb2" Completed="sb2_Completed">
      <DoubleAnimation Storyboard.TargetName="Obdelnik"
        Storyboard.TargetProperty="(Canvas.Left)"
        From="500" To="250" Duration="0:0:2"/>
    </Storyboard>

    <Storyboard x:Name="sb3">
      <DoubleAnimation Storyboard.TargetName="Obdelnik"
        Storyboard.TargetProperty="Opacity"
        From="1.0" To="0.0" Duration="0:0:5" 
        AutoReverse="True" RepeatBehavior="Forever"  />
    </Storyboard>
  </Canvas.Resources>

  <Rectangle x:Name="Obdelnik" Width="150" Height="100" 
    Canvas.Left="100" Canvas.Top="100" Fill="Blue" />
</Canvas>


C#:
public MainPage()
{
  InitializeComponent();
  sb1.Begin();
}

void sb1_Completed(object sender, EventArgs e)
{
  sb2.Begin();
}

  void sb2_Completed(object sender, EventArgs e)
{
  sb3.Begin();
}



strana 221
----------
<Canvas x:Name="LayoutRoot" Background="White">
  <Path Fill="Blue">
    <Path.Data>
      <EllipseGeometry x:Name="Kruh" Center="50,50" 
        RadiusX="30" RadiusY="30" />
    </Path.Data>
  </Path>
</Canvas>



strana 223
----------
C#:
public MainPage()
{
  InitializeComponent();
  Animace();
}

private void Animace()
{
  // Vytvoření objektu pro animaci - obdélníka
  Rectangle myRectangle = new Rectangle();
  myRectangle.Width = 200;
  myRectangle.Height = 150;
  myRectangle.Fill = new SolidColorBrush(Colors.Blue);
  LayoutRoot.Children.Add(myRectangle);

  // Trvání děje bude 3 sekundy
  Duration duration = new Duration(TimeSpan.FromSeconds(3));

  // Dva objekty pro animaci, každý pro pohyb v jedné ose
  DoubleAnimation myDoubleAnimation1 = new DoubleAnimation();
  DoubleAnimation myDoubleAnimation2 = new DoubleAnimation();

  myDoubleAnimation1.Duration = duration;
  myDoubleAnimation2.Duration = duration;

  Storyboard sb = new Storyboard();
  sb.Duration = duration;

  sb.Children.Add(myDoubleAnimation1);
  sb.Children.Add(myDoubleAnimation2);

  Storyboard.SetTarget(myDoubleAnimation1, myRectangle);
  Storyboard.SetTarget(myDoubleAnimation2, myRectangle);

  // Definování animace pro příslušnou osu
  Storyboard.SetTargetProperty(myDoubleAnimation1,
    new PropertyPath("(Canvas.Left)"));
  Storyboard.SetTargetProperty(myDoubleAnimation2,
    new PropertyPath("(Canvas.Top)"));

  myDoubleAnimation1.To = 400;
  myDoubleAnimation2.To = 300;

  LayoutRoot.Resources.Add("unique_id", sb);
  sb.Begin();
}





strana 224
----------
<Grid x:Name="LayoutRoot" Background="White">
  <Grid.Resources>
    <Storyboard x:Name="sb1">

      <!-- Zvětšení tlačítka v ose X. -->
      <DoubleAnimation
        Storyboard.TargetName="myScaleTransform"
        Storyboard.TargetProperty="ScaleX"
        To="1.5" Duration="0:0:0.5" AutoReverse="True" />

      <!-- Zvětšení tlačítka v ose Y. -->
      <DoubleAnimation
        Storyboard.TargetName="myScaleTransform"
        Storyboard.TargetProperty="ScaleY"
        To="1.5" Duration="0:0:0.5" AutoReverse="True" />

      <!-- Posun tlačítka v ose X. -->
      <DoubleAnimation
        Storyboard.TargetName="myTranslateTransform"
        Storyboard.TargetProperty="X"
        To="-30" Duration="0:0:0.5" AutoReverse="True" />

      <!-- Posun tlačítka v ose Y. -->
      <DoubleAnimation
        Storyboard.TargetName="myTranslateTransform"
        Storyboard.TargetProperty="Y"
        To="-30" Duration="0:0:0.5" AutoReverse="True" />

      <!—Hloubka stínu -->
      <DoubleAnimation
        Storyboard.TargetName="myDropShadowEffect"
        Storyboard.TargetProperty="ShadowDepth"
        To="30" Duration="0:0:0.5" AutoReverse="True" />

      <!—Rozostření stínu (BlurEffect). -->
      <DoubleAnimation
        Storyboard.TargetName="myDropShadowEffect"
        Storyboard.TargetProperty="BlurRadius"
        To="10" Duration="0:0:0.5" AutoReverse="True" />

    </Storyboard>
  </Grid.Resources>

  <Button x:Name="btAnimuj" Content="Zaregistruj se!" 
    Click="btAnimuj_Click" Width="200" Height="30">
    <Button.Effect>
      <DropShadowEffect x:Name="myDropShadowEffect" />
    </Button.Effect>
    <Button.RenderTransform>
      <TransformGroup>
        <TranslateTransform x:Name="myTranslateTransform" />
        <ScaleTransform x:Name="myScaleTransform" />
      </TransformGroup>
    </Button.RenderTransform>
  </Button>
</Grid>


C#:
private void btAnimuj_Click(object sender, RoutedEventArgs args)
{
  sb1.Begin();
}



strana 226
----------
<Canvas x:Name="LayoutRoot" Background="White">
  <Canvas.Resources>
    <Storyboard x:Name="sb1">
      <DoubleAnimationUsingKeyFrames
        Storyboard.TargetName="Obdelnik"
        Storyboard.TargetProperty="(Canvas.Left)"
        RepeatBehavior="Forever">
        <LinearDoubleKeyFrame Value="100" KeyTime="0:0:0"/>
        <LinearDoubleKeyFrame Value="500" KeyTime="0:0:2"/>
        <LinearDoubleKeyFrame Value="100" KeyTime="0:0:6"/>
      </DoubleAnimationUsingKeyFrames>
    </Storyboard>
  </Canvas.Resources>
  
  <Rectangle x:Name="Obdélník" Width="150" Height="100" 
    Canvas.Left="100" Canvas.Top="100" Fill="Blue" />
</Canvas>



strana 227
----------
<UserControl.Resources>
  <Storyboard x:Name="sb1">
    <DoubleAnimationUsingKeyFrames
      Storyboard.TargetName="SplineTransform"
      Storyboard.TargetProperty="X" Duration="0:0:15">

      <SplineDoubleKeyFrame Value="500"
        KeyTime="0:0:7" KeySpline="0.0,1.0 1.0,0.0" />
      <SplineDoubleKeyFrame Value="200"
        KeyTime="0:0:10" KeySpline="0.0,0.0 1.0,0.0" />
      <SplineDoubleKeyFrame Value="350"
        KeyTime="0:0:15" KeySpline="0.25,0.5 0.75,1" />
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>
</UserControl.Resources>

<Grid x:Name="LayoutRoot" Background="White">
  <Canvas>
    <Rectangle Fill="Blue" Width="100" Height="100">
      <Rectangle.RenderTransform>
        <TranslateTransform x:Name="SplineTransform"  X="0" Y="0" />
      </Rectangle.RenderTransform>
    </Rectangle>
  </Canvas>
</Grid>



strana 229
----------
<Canvas x:Name="LayoutRoot" Background="White">
  <Canvas.Resources>
    <Storyboard x:Name="sb1">
      <DoubleAnimation From="100" To="300" Duration="0:0:5"
        Storyboard.TargetName="kruh"
        Storyboard.TargetProperty="(Canvas.Top)">
        <DoubleAnimation.EasingFunction>
          <BackEase EasingMode="EaseIn" Amplitude="1"></BackEase>
        </DoubleAnimation.EasingFunction>
      </DoubleAnimation>
    </Storyboard>
  </Canvas.Resources>
  <Ellipse Name="kruh" Width="50" Height="50" Fill="Blue"></Ellipse>
</Canvas>



strana 230
----------
<Canvas x:Name="LayoutRoot" Background="White">
  <Canvas.Resources>
    <Storyboard x:Name="pohyb">
      <DoubleAnimation From="0" To="200" Duration="0:0:5"
        Storyboard.TargetName="kruh"
        Storyboard.TargetProperty="(Canvas.Top)">
        <DoubleAnimation.EasingFunction>
          <BounceEase EasingMode="EaseOut" Bounces="10" Bounciness="1">
          </BounceEase>
        </DoubleAnimation.EasingFunction>
      </DoubleAnimation>
    </Storyboard>
  </Canvas.Resources>
  <Ellipse Name="kruh" Width="50" Height="50" Fill="Blue" 
    Canvas.Top="0" Canvas.Left="0" ></Ellipse>
</Canvas>


<Canvas x:Name="LayoutRoot" Background="White">
  <Canvas.Resources>
    <Storyboard x:Name="sb1">
      <DoubleAnimation From="100" To="300" Duration="0:0:5"
        Storyboard.TargetName="kruh"
        Storyboard.TargetProperty="(Canvas.Top)">
        <DoubleAnimation.EasingFunction>
          <CircleEase EasingMode="EaseIn"></CircleEase>
        </DoubleAnimation.EasingFunction>
      </DoubleAnimation>
    </Storyboard>
  </Canvas.Resources>
  <Ellipse Name="kruh" Width="50" Height="50" Fill="Blue"></Ellipse>
</Canvas>


strana 232
----------
<Canvas x:Name="LayoutRoot" Background="White">
  <Canvas.Resources>
    <Storyboard x:Name="sb1">
      <DoubleAnimation From="150" To="300" Duration="0:0:5"
        Storyboard.TargetName="kruh"
        Storyboard.TargetProperty="(Canvas.Top)">
        <DoubleAnimation.EasingFunction>
          <ElasticEase EasingMode="EaseOut" Oscillations="5" 
            Springiness="3" ></ElasticEase>
        </DoubleAnimation.EasingFunction>
      </DoubleAnimation>
    </Storyboard>
  </Canvas.Resources>
  <Ellipse Name="kruh" Width="50" Height="50" Fill="Blue"></Ellipse>
</Canvas>



