首页 新闻 搜索 专区 学院

WPF Viewport3D里实现动画

0
悬赏园豆:60 [已关闭问题] 关闭于 2011-06-30 08:20

在Viewport3D里放了一个Canvas,Canvas里又放了个image,我现在想实现image的缩放效果,可是加了动画后,一点击就消失了,淡出淡入就可以。。。不理解其原因,代码如下

View Code
private void CartNoon()
{
DoubleAnimation da1
= new DoubleAnimation();
da1.From
= 1000;
da1.To
= 0;

Duration time
= new TimeSpan(0, 0, 0, 2, 0);
da1.Duration
=

time;
story.Children.Add(da1);
//NameScope.SetNameScope(this, new NameScope());
//this.RegisterName("iv3d", lp0.Children[0] as Image);
da1.SetValue(Storyboard.TargetNameProperty, "lp0");

da1.SetValue(Storyboard.TargetPropertyProperty,
new PropertyPath(Canvas.RightProperty));


}
View Code
前台代码
<Viewport3D x:Name="viewPort3D" IsHitTestVisible="False" RenderOptions.EdgeMode="Aliased" ClipToBounds="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<Viewport3D.Camera>
<PerspectiveCamera Position="-0.3,-0.5,9" />
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<AmbientLight Color="White"/>
</ModelVisual3D.Content>
</ModelVisual3D>
<Viewport2DVisual3D x:Name="viewport2DVisual3D0" Geometry="{StaticResource geometry1}" Material="{StaticResource material}">
<Viewport2DVisual3D.Transform>
<Transform3DGroup>
<Transform3DGroup>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0,1.,0" Angle="-45"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
<TranslateTransform3D OffsetX="-3.95" OffsetY="0" OffsetZ="0" />
<ScaleTransform3D ScaleX="1.04" ScaleY="1.55"></ScaleTransform3D>
</Transform3DGroup>
</Transform3DGroup>
</Viewport2DVisual3D.Transform>
<Viewport2DVisual3D.Visual
>
<Canvas Name="lp0">
<Image Source="Images\050817goodfeng14.jpg" Opacity="1" />
</Canvas>

</Viewport2DVisual3D.Visual>
</Viewport2DVisual3D>
郭凯的主页 郭凯 | 初学一级 | 园豆:125
提问于:2011-05-12 17:19
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册