level 11
RT,我有两种实现思路,
比如我想让一个圆形做圆周运动,
思路一是用GDI画一个圆,然后不停刷新圆的坐标;
思路二是用picturebox,然后用timer以圆方程为基础重设picbox坐标;
但才疏学浅还望大神多多指教!希望能给出具体代码,不胜感激
2016年12月30日 13点12分
1
level 13
这东西用 Blend for Visual Studio 拖个圆形路径动画就出来了。什么代码都不用写。
_
2017年01月01日 14点01分
3
哦
![[咦]](/static/emoticons/u54a6.png)
这是插件吗?
2017年01月02日 02点01分
回复 福厦高速 : 跟visual studio 捆绑安装的 _
2017年01月02日 02点01分
level 13
<Window.Resources>
<Storyboard x:Key="Storyboard1" RepeatBehavior="Forever">
<DoubleAnimationUsingPath Duration="0:0:2" Source="X" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="button">
<DoubleAnimationUsingPath.PathGeometry>
<PathGeometry Figures="M120.385,141.055 C120.385,204.40869 71.175945,255.767 10.4735,255.767 C-50.228945,255.767 -99.438,204.40869 -99.438,141.055 C-99.438,77.701312 -50.228945,26.343 10.4735,26.343 C71.175945,26.343 120.385,77.701312 120.385,141.055 z"/>
</DoubleAnimationUsingPath.PathGeometry>
</DoubleAnimationUsingPath>
<DoubleAnimationUsingPath Duration="0:0:2" Source="Y" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="button">
<DoubleAnimationUsingPath.PathGeometry>
<PathGeometry Figures="M120.385,141.055 C120.385,204.40869 71.175945,255.767 10.4735,255.767 C-50.228945,255.767 -99.438,204.40869 -99.438,141.055 C-99.438,77.701312 -50.228945,26.343 10.4735,26.343 C71.175945,26.343 120.385,77.701312 120.385,141.055 z"/>
</DoubleAnimationUsingPath.PathGeometry>
</DoubleAnimationUsingPath>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</EventTrigger>
</Window.Triggers>
<Grid>
<Ellipse Fill="#FFF4F4F5" Margin="97.247,64.646,198.93,23.93" Stroke="Black"/>
<Button x:Name="button" Content="Button" Height="41.896" Margin="132.16,17.855,254.79,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Button.RenderTransform>
</Button>
</Grid>
这是拖圆形路径动画之后生成的代码。应该对楼主有帮助。
_
2017年01月01日 14点01分
4
level 9
如果wpf直接做动画,如果winform写一个自定义控件usercontrol好了,可以复用。
2017年01月30日 18点01分
7