質問編集履歴
1
コード追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,101 @@
|
|
1
1
|
ベジエ曲線に沿ってアニメーションさせることは出来たのですが、スプライン曲線に沿ってアニメーションさせる方法がわかりません。
|
2
2
|
|
3
3
|
そもそも可能なのでしょうか?
|
4
|
+
|
5
|
+
XAMLのコードを追記します。(ベジエ曲線に沿ったアニメーション)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
<Window x:Class="MainWindow"
|
10
|
+
|
11
|
+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
12
|
+
|
13
|
+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
14
|
+
|
15
|
+
xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
16
|
+
|
17
|
+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
18
|
+
|
19
|
+
mc:Ignorable="PresentationOptions" Margin="20"
|
20
|
+
|
21
|
+
Title="howto_path_animation" Height="400" Width="400">
|
22
|
+
|
23
|
+
<Canvas Width="400" Height="400">
|
24
|
+
|
25
|
+
<Path Stroke="Red" StrokeThickness="1">
|
26
|
+
|
27
|
+
<Path.Data>
|
28
|
+
|
29
|
+
<PathGeometry Figures="M 10,200 C 35,100 135,100 160,200 180,350 285,300 310,100"/>
|
30
|
+
|
31
|
+
</Path.Data>
|
32
|
+
|
33
|
+
</Path>
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
<Rectangle Width="50" Height="20" Fill="LightBlue" Stroke="Blue">
|
38
|
+
|
39
|
+
<Rectangle.RenderTransform>
|
40
|
+
|
41
|
+
<TransformGroup>
|
42
|
+
|
43
|
+
<TranslateTransform X="-30" Y="-10"/>
|
44
|
+
|
45
|
+
<MatrixTransform x:Name="rectangleTransform">
|
46
|
+
|
47
|
+
<MatrixTransform.Matrix >
|
48
|
+
|
49
|
+
<Matrix />
|
50
|
+
|
51
|
+
</MatrixTransform.Matrix>
|
52
|
+
|
53
|
+
</MatrixTransform>
|
54
|
+
|
55
|
+
</TransformGroup>
|
56
|
+
|
57
|
+
</Rectangle.RenderTransform>
|
58
|
+
|
59
|
+
<Rectangle.Triggers>
|
60
|
+
|
61
|
+
<EventTrigger RoutedEvent="Rectangle.Loaded">
|
62
|
+
|
63
|
+
<BeginStoryboard>
|
64
|
+
|
65
|
+
<Storyboard>
|
66
|
+
|
67
|
+
<MatrixAnimationUsingPath
|
68
|
+
|
69
|
+
Storyboard.TargetName="rectangleTransform"
|
70
|
+
|
71
|
+
Storyboard.TargetProperty="Matrix"
|
72
|
+
|
73
|
+
DoesRotateWithTangent="True"
|
74
|
+
|
75
|
+
Duration="0:0:3"
|
76
|
+
|
77
|
+
RepeatBehavior="Forever" >
|
78
|
+
|
79
|
+
<MatrixAnimationUsingPath.PathGeometry>
|
80
|
+
|
81
|
+
<PathGeometry
|
82
|
+
|
83
|
+
Figures="M 10,200 C 35,100 135,100 160,200 180,350 285,300 310,100" />
|
84
|
+
|
85
|
+
</MatrixAnimationUsingPath.PathGeometry>
|
86
|
+
|
87
|
+
</MatrixAnimationUsingPath>
|
88
|
+
|
89
|
+
</Storyboard>
|
90
|
+
|
91
|
+
</BeginStoryboard>
|
92
|
+
|
93
|
+
</EventTrigger>
|
94
|
+
|
95
|
+
</Rectangle.Triggers>
|
96
|
+
|
97
|
+
</Rectangle>
|
98
|
+
|
99
|
+
</Canvas>
|
100
|
+
|
101
|
+
</Window>
|