wpf RenderTransform

	    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();



 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值