邢台中北世纪城网站兼职,WordPress mk主题,为什么没人做物流网站,手机网站推广法一、动画合集
创建一个Storyboard演示画板#xff0c;在画板里对动画进行定义与处理。
常见动画类型
提醒#xff1a;更多介绍可查看microsoft提供的相关文档 DoubleAnimation //普通Double型控制动画 DoubleAnimationUsingKeyFrames //Dou…一、动画合集
创建一个Storyboard演示画板在画板里对动画进行定义与处理。
常见动画类型
提醒更多介绍可查看microsoft提供的相关文档 DoubleAnimation //普通Double型控制动画 DoubleAnimationUsingKeyFrames //Double型关键帧动画 ObjectAnimationUsingKeyFrames //Object型关键帧动画 ColorAnimationUsingKeyFrames //Color型关键帧动画 StringAnimationUsingKeyFrames //String型关键帧动画 MatrixAnimationUsingPath //沿路径型动画 1、资源里添加动画资源
注意开始动画得自己规划逻辑触发器、事件都可 var storybd this.FindResource(storybd) as Storyboard;storybd.Begin(); Window.ResourcesStoryboard x:KeystorybdDoubleAnimation AutoReverseTrueBy0.1RepeatBehaviorForeverStoryboard.TargetNamebtnStoryboard.TargetPropertyOpacityFrom0.0 /DoubleAnimation AutoReverseTrueRepeatBehaviorForeverStoryboard.TargetNamebtnStoryboard.TargetProperty(Control.Background).(RadialGradientBrush.GradientStops)[1].OffsetFrom1To0Duration0:0:1 //Storyboard/Window.Resources2、事件触发器里开始一个动画 Rectangle NameRectWidth70Height80Margin279,0,0,0HorizontalAlignmentLeftVerticalAlignmentCenterFillGreenRectangle.TriggersEventTrigger RoutedEventRectangle.LoadedBeginStoryboardStoryboardDoubleAnimation AutoReverseTrueRepeatBehaviorForeverStoryboard.TargetNameRectStoryboard.TargetPropertyOpacityFrom1To0Duration0:0:1 //Storyboard/BeginStoryboard/EventTrigger/Rectangle.Triggers/Rectangle
3、Double型关键帧动画
DoubleAnimationUsingKeyFrames AutoReverseTrueRepeatBehaviorForeverStoryboard.TargetNameRectStoryboard.TargetProperty(FrameworkElement.Width)EasingDoubleKeyFrame KeyTime0:0:0 Value0 / EasingDoubleKeyFrame KeyTime0:0:5 Value70 /
/DoubleAnimationUsingKeyFrames
DoubleAnimationUsingKeyFrames AutoReverseTrueRepeatBehaviorForeverStoryboard.TargetNameRectStoryboard.TargetProperty(FrameworkElement.Height)EasingDoubleKeyFrame KeyTime0:0:0 Value0 /EasingDoubleKeyFrame KeyTime0:0:5 Value80 /
/DoubleAnimationUsingKeyFrames
4、Object型关键帧动画 Window.ResourcesStoryboard x:KeystoryObjectAnimationUsingKeyFrames Storyboard.TargetNameimg AutoReverseTrue RepeatBehaviorForever Storyboard.TargetProperty(UIElement.Visibility)DiscreteObjectKeyFrame KeyTime0:0:0.03 Value{x:Static Visibility.Hidden}/DiscreteObjectKeyFrame KeyTime0:0:0.06 Value{x:Static Visibility.Visible}//ObjectAnimationUsingKeyFrames/Storyboard/Window.Resources
5、Color型关键帧动画 Storyboard x:KeystoryColorAnimationUsingKeyFrames AutoReverseTrueRepeatBehaviorForeverStoryboard.TargetNamebtnStoryboard.TargetProperty(Button.Background).(SolidColorBrush.Color)EasingColorKeyFrame KeyTime0 ValueRed /EasingColorKeyFrame KeyTime0:0:0.5 ValueBlue /DiscreteColorKeyFrame KeyTime0:0:1 ValueRed /DiscreteColorKeyFrame KeyTime0:0:1.5 ValueYellow //ColorAnimationUsingKeyFrames/Storyboard
6、String型关键帧动画 FillBehavior动画结束时行为 HoldEnd保持在动画结束的最后一帧画面 Stop动画结束恢复动画开始前的画面 StringAnimationUsingKeyFrames FillBehaviorHoldEndStoryboard.TargetNamebtnStoryboard.TargetProperty(Button.Content)DiscreteStringKeyFrame KeyTime0 Value5s /DiscreteStringKeyFrame KeyTime0:0:1 Value4s /DiscreteStringKeyFrame KeyTime0:0:2 Value3s /DiscreteStringKeyFrame KeyTime0:0:3 Value2s /DiscreteStringKeyFrame KeyTime0:0:4 Value1s /DiscreteStringKeyFrame KeyTime0:0:5 Value0s //StringAnimationUsingKeyFrames
7、Matrix型沿路径动画
使用如下
移动控件可用RenderTransformOrigin0.5,0.5切换位置转换的中心点
DoesRotateWithTangent按切换方向旋转
PathGeometry指定路径 Rectangle.RenderTransformMatrixTransform //Rectangle.RenderTransformMatrixAnimationUsingPath AutoReverseTrueDoesRotateWithTangentTruePathGeometry{StaticResource Path2}RepeatBehaviorForeverStoryboard.TargetNameRectStoryboard.TargetPropertyRenderTransform.MatrixDuration0:0:3 / 二、扩展
1、流动Path StrokeDashArray 分段长度 StrokeDashOffset分段偏移值改变该值实现流动效果 StrokeDashArray5 StrokeDashOffset{Binding OffSet} 2、变形 控制变形的属性RenderTransform呈现变形定义在UIElement类中 LayoutTransform布局变形定义在FrameworkElement类中 其数据类型都是Transform抽象类 Transform派生类; 1、MatrixTransform矩阵变形 2、RotateTransform旋转变形 3、ScaleTransform坐标系变形 4、SkewTransform拉伸变形 5、TranslateTransform偏移变形 6、TransformGroup变形组多个独立变形合成一个变形组