Silverlight/XAML – Learning by Coding

[ keyframe_animation.xaml --> Grafik anzeigen ]

 1: <?xml version="1.0" encoding="UTF-8"?>
 2: <!-- coded by Thomas Meinike 01/08 -->
 3: <Canvas xmlns="http://schemas.microsoft.com/client/2007"
 4:         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 5: 
 6:   <Rectangle x:Name="rechteck" Width="300" Height="150" Canvas.Left="20" Canvas.Top="20"
 7:              Fill="#090"/>
 8:   
 9:   <Canvas.Triggers>
10:     <EventTrigger RoutedEvent="Canvas.Loaded">
11:       <EventTrigger.Actions>
12:         <BeginStoryboard>
13:           <Storyboard>
14:             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"    
15:               Storyboard.TargetName="rechteck"    
16:               Storyboard.TargetProperty="(UIElement.Opacity)">  
17:               <LinearDoubleKeyFrame KeyTime="00:00:00" Value="1.0"/>  
18:               <LinearDoubleKeyFrame KeyTime="00:00:10" Value="0.1"/>  
19:             </DoubleAnimationUsingKeyFrames>
20:           </Storyboard>
21:         </BeginStoryboard>
22:       </EventTrigger.Actions>
23:     </EventTrigger>
24:   </Canvas.Triggers>
25: 
26: 
27:   <!--
28:       weitere Techniken statt LinearDoubleKeyFrame
29:       mit den Attributen KeyTime und Value
30:       innerhalb von DoubleAnimationUsingKeyFrames:
31: 
32:       DiscreteDoubleKeyFrame 
33: 
34:       SplineDoubleKeyFrame mit zusätzlichem KeySpline-Attribut
35:         und Wert im Bereich von "0.0,0.0 1.0,1.0"
36:   -->
37: 
38: </Canvas>

[zum Anfang]