wpf RenderTransform
来源:互联网 发布:詹姆斯数据排名 编辑:程序博客网 时间:2024/06/05 11:40
var storyboard = new Storyboard(); Storyboard.SetTarget(storyboard, grid); Storyboard.SetTargetProperty(storyboard, new PropertyPath(Grid.OpacityProperty)); var OpacityDoubleAnimation = new DoubleAnimation(); OpacityDoubleAnimation.From = 0; OpacityDoubleAnimation.To = 1; OpacityDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(1)); storyboard.Children.Add(OpacityDoubleAnimation); storyboard.Begin(); TransformGroup group = new TransformGroup(); RotateTransform rtf = new RotateTransform(); group.Children.Add(rtf); ScaleTransform rtf2 = new ScaleTransform(); group.Children.Add(rtf2); grid.RenderTransform = group; Storyboard.SetTargetProperty(storyboard, new PropertyPath("RenderTransform.Children[0].Angle")); DoubleAnimation dbAscending = new DoubleAnimation(70, 0, new Duration(TimeSpan.FromSeconds(1))); storyboard.Children.Add(dbAscending); storyboard.Begin(); Storyboard.SetTargetProperty(storyboard, new PropertyPath("RenderTransform.Children[1].ScaleX")); DoubleAnimation dbAscending2 = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(1))); dbAscending2.AccelerationRatio = 1; storyboard.Children.Add(dbAscending2); storyboard.Begin(); Storyboard.SetTargetProperty(storyboard, new PropertyPath("RenderTransform.Children[1].ScaleY")); DoubleAnimation dbAscending3 = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(1))); dbAscending3.AccelerationRatio = 1; storyboard.Children.Add(dbAscending3); storyboard.Begin(); Storyboard.SetTargetProperty(storyboard, new PropertyPath("RenderTransform.Children[1].ScaleX")); DoubleAnimation dbAscending4 = new DoubleAnimation(); dbAscending4.Duration = new Duration(TimeSpan.FromSeconds(0.05)); dbAscending4.BeginTime = TimeSpan.FromSeconds(1); dbAscending4.To = 0.98; dbAscending4.AccelerationRatio = 1; storyboard.Children.Add(dbAscending4); storyboard.Begin(); Storyboard.SetTargetProperty(storyboard, new PropertyPath("RenderTransform.Children[1].ScaleY")); DoubleAnimation dbAscending5 = new DoubleAnimation(); dbAscending5.Duration = new Duration(TimeSpan.FromSeconds(0.05)); dbAscending5.BeginTime = TimeSpan.FromSeconds(1); dbAscending5.To = 0.98; dbAscending5.AccelerationRatio = 1; storyboard.Children.Add(dbAscending5); storyboard.Begin(); Storyboard.SetTargetProperty(storyboard, new PropertyPath("RenderTransform.Children[1].ScaleX")); DoubleAnimation dbAscending6 = new DoubleAnimation(); dbAscending6.Duration = new Duration(TimeSpan.FromSeconds(0.2)); dbAscending6.BeginTime = TimeSpan.FromSeconds(1.05); dbAscending6.To = 1; dbAscending6.AccelerationRatio = 1; storyboard.Children.Add(dbAscending6); storyboard.Begin(); Storyboard.SetTargetProperty(storyboard, new PropertyPath("RenderTransform.Children[1].ScaleY")); DoubleAnimation dbAscending7 = new DoubleAnimation(); dbAscending7.Duration = new Duration(TimeSpan.FromSeconds(0.2)); dbAscending7.BeginTime = TimeSpan.FromSeconds(1.05); dbAscending7.To = 1; dbAscending7.AccelerationRatio = 1; storyboard.Children.Add(dbAscending7); storyboard.Begin();
与下效果一样
<BeginStoryboard> <Storyboard SpeedRatio="1.5"> <DoubleAnimation Storyboard.TargetName="element" Storyboard.TargetProperty="Opacity" From="0.2" To="1" Duration="0:0:2.5"></DoubleAnimation> <DoubleAnimation Storyboard.TargetName="element" Storyboard.TargetProperty="RenderTransform.Children[1].Angle" From="70" To="0" Duration="0:0:2" ></DoubleAnimation> <DoubleAnimation Storyboard.TargetName="element" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX" From="0" To="1" Duration="0:0:2" AccelerationRatio="1"></DoubleAnimation> <DoubleAnimation Storyboard.TargetName="element" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY" From="0" To="1" Duration="0:0:2" AccelerationRatio="1"></DoubleAnimation> <DoubleAnimation Storyboard.TargetName="element" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX" To="0.98" BeginTime="0:0:2" Duration="0:0:0.05" DecelerationRatio="1"></DoubleAnimation> <DoubleAnimation Storyboard.TargetName="element" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY" To="0.98" BeginTime="0:0:2" Duration="0:0:0.05" DecelerationRatio="1"></DoubleAnimation> <DoubleAnimation Storyboard.TargetName="element" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX" To="1" BeginTime="0:0:2.05" Duration="0:0:0.2" AccelerationRatio="1"></DoubleAnimation> <DoubleAnimation Storyboard.TargetName="element" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY" To="1" BeginTime="0:0:2.05" Duration="0:0:0.2" AccelerationRatio="1"></DoubleAnimation> </Storyboard> </BeginStoryboard><Grid> <Grid.RenderTransform> <TransformGroup> <ScaleTransform></ScaleTransform> <RotateTransform></RotateTransform> </TransformGroup> </Grid.RenderTransform> </Grid>
//这条是TranslateTransform.XProperty
var storyboard = new Storyboard(); Storyboard.SetTarget(storyboard, popupgrid); TranslateTransform rtf = new TranslateTransform();popupgrid.RenderTransform = rtf;Storyboard.SetTargetProperty(storyboard, new PropertyPath(TranslateTransform.XProperty));
DoubleAnimation dbAscending2 = new DoubleAnimation(0, 100, new Duration(TimeSpan.FromSeconds(2)));
dbAscending2.AccelerationRatio = 1;
storyboard.Children.Add(dbAscending2);
storyboard.Begin();
- wpf RenderTransform
- WPF: RenderTransform特效
- WPF: RenderTransform特效
- RenderTransform
- RenderTransform特效
- silverlight-RenderTransform特效
- RenderTransform、Projection、Clip、 UseLayoutRounding 说明
- #770 –LayoutTransform和RenderTransform属性的区别(Difference Between LayoutTransform and RenderTransform)
- RenderTransform特效【五种基本变换】及【矩阵变换MatrixTransform】
- RenderTransform特效【五种基本变换】及【矩阵变换MatrixTransform】
- WPF
- WPF
- WPF
- WPF
- WPF
- WPF
- WPF
- WPF
- ClassCastException: $Proxy0 cannot be cast to (com......) 的解决办法
- 正则表达式
- java定时器
- 23步安装SQLServer 2008 R2
- Hibernate入门(附源代码,jar包)
- wpf RenderTransform
- Unicode字符与GB2312的相互转换
- 6-2.1 填空
- IBM Rational Software Architect 建模
- 平面坐标点类
- 项目 2.2
- spring 的配置文件applicationContext.xml详解
- DOM中nodeName、nodeValue 及 nodeType的说明
- 坐标