* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
2.9 KiB
title, ms.date, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | |||
|---|---|---|---|---|---|---|
| How to: Simplify Animations by Using Child Timelines | 03/30/2017 |
|
8335d770-d13d-42bd-8dfa-63f92c0327e2 |
How to: Simplify Animations by Using Child Timelines
This example shows how to simplify animations by using child xref:System.Windows.Media.Animation.ParallelTimeline objects. A xref:System.Windows.Media.Animation.Storyboard is a type of xref:System.Windows.Media.Animation.Timeline that provides targeting information for the timelines it contains. Use a xref:System.Windows.Media.Animation.Storyboard to provide timeline targeting information, including object and property information.
To begin an animation, use one or more xref:System.Windows.Media.Animation.ParallelTimeline objects as nested child elements of a xref:System.Windows.Media.Animation.Storyboard. These xref:System.Windows.Media.Animation.ParallelTimeline objects can contain other animations and therefore, can better encapsulate the timing sequences in complex animations. For example, if you are animating a xref:System.Windows.Controls.TextBlock and several shapes in the same xref:System.Windows.Media.Animation.Storyboard, you can separate the animations for the xref:System.Windows.Controls.TextBlock and the shapes, putting each into a separate xref:System.Windows.Media.Animation.ParallelTimeline. Because each xref:System.Windows.Media.Animation.ParallelTimeline has its own xref:System.Windows.Media.Animation.Timeline.BeginTime%2A and all child elements of the xref:System.Windows.Media.Animation.ParallelTimeline begin relative to this xref:System.Windows.Media.Animation.Timeline.BeginTime%2A, timing is better encapsulated.
The following example animates two pieces of text (xref:System.Windows.Controls.TextBlock objects) from within the same xref:System.Windows.Media.Animation.Storyboard. A xref:System.Windows.Media.Animation.ParallelTimeline encapsulates the animations of one of the xref:System.Windows.Controls.TextBlock objects.
Performance Note: Although you can nest xref:System.Windows.Media.Animation.Storyboard timelines inside each other, xref:System.Windows.Media.Animation.ParallelTimelines are more suitable for nesting because they require less overhead. (The xref:System.Windows.Media.Animation.Storyboard class inherits from the xref:System.Windows.Media.Animation.ParallelTimeline class.)
Example
[!code-xamlTimelines_snip#ParallelTimelineWholePage]