首页 > 代码库 > Silverlight代码编写对控件的PlaneProjection.RotationY属性控制动画
Silverlight代码编写对控件的PlaneProjection.RotationY属性控制动画
Canvas c; void btnDraw_Click(object sender, RoutedEventArgs e) { Storyboard story = new Storyboard(); DoubleAnimation yAnimation = new DoubleAnimation(); yAnimation.From = 0.5; yAnimation.To = 100; yAnimation.Duration = new Duration(TimeSpan.FromSeconds(5)); PlaneProjection pp = (PlaneProjection)c.Projection; //找到注册的属性 Storyboard.SetTarget(yAnimation, pp); Storyboard.SetTargetProperty(yAnimation, new PropertyPath(PlaneProjection.RotationYProperty)); story.Children.Add(yAnimation); story.Begin(); }
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
c = new Canvas();
c.Height = 200;
c.Width = 200;
c.Background = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
PlaneProjection pp = new PlaneProjection() { RotationY = 0 };//这里已经指定了RotationY
c.Projection = pp;
LayoutRoot.Children.Add(c);
}
以上代码实现了对控件RotationY属性的动画控制!
// 在此处添加事件处理程序实现。 Storyboard sboard1 = new Storyboard(); DoubleAnimation daAngle1 = new DoubleAnimation(); sboard1 .Completed+=new EventHandler(sboard1_Completed); Storyboard.SetTarget(daAngle1, Grid1 ); Storyboard.SetTargetProperty(daAngle1, new PropertyPath("(canvas.left)")); daAngle1.From = 0; daAngle1.To = -850; daAngle1.Duration = TimeSpan.FromSeconds(1); sboard1.Children.Add(daAngle1); sboard1.Begin();
横移动画!
Silverlight代码编写对控件的PlaneProjection.RotationY属性控制动画
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。