Je fouille autour de l'animation dans WPF et je suis confus. Pour RectAnimation, By ne peut pas être négatif pour la hauteur et la largeur. Donc, si vous utilisez le mot-clé "By", les rectangles ne peuvent que croître (au lieu de "To")?Animation WPF - Pourquoi "By" n'a pas de valeur négative?
Voici quelques exemples de code:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<StackPanel Orientation="Vertical" HorizontalAlignment="Left">
<Path Stroke="Black" StrokeThickness="1" Fill="LemonChiffon">
<Path.Data>
<RectangleGeometry x:Name="myRectangleGeometry" Rect="0,200,100,100" />
</Path.Data>
<Path.Triggers>
<EventTrigger RoutedEvent="Path.Loaded">
<BeginStoryboard>
<Storyboard>
<!-- Animate the Rect property of the RectangleGeometry
which causes the rectangle to animate postion and size. -->
<RectAnimation
Storyboard.TargetName="myRectangleGeometry"
Storyboard.TargetProperty ="Rect"
Duration="0:0:2" FillBehavior="HoldEnd"
From="0,0,100,100"
By="600,50,200,-50" />
^
</Storyboard> |
</BeginStoryboard> |
</EventTrigger> |
</Path.Triggers> |
</Path> |
</StackPanel> |
</Page> |
|
This returns an error, but only if it is negative.
Lol, downvote sans commentaire. Vous devez l'aimer quand les gens sont des poules. – Vaccano
+1 offset ... quelqu'un m'a rabaissé dessus pour une raison quelconque ... –