本文整理匯總了C#中System.Windows.Media.Media3D.PerspectiveCamera.BeginAnimation方法的典型用法代碼示例。如果您正苦於以下問題:C# PerspectiveCamera.BeginAnimation方法的具體用法?C# PerspectiveCamera.BeginAnimation怎麽用?C# PerspectiveCamera.BeginAnimation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Media.Media3D.PerspectiveCamera
的用法示例。
在下文中一共展示了PerspectiveCamera.BeginAnimation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Generate
/// <summary>
/// Creates the viewport for this bar graph.
/// </summary>
protected override void Generate()
{
CalculateValues();
double camY = ((_Max - _Min) / 2d + _Min) * _HeightRatio;
if (Viewport != null)
{
_Camera = Viewport.Camera as PerspectiveCamera;
Point3DAnimation anim = new Point3DAnimation(new Point3D(0, camY, -5), TransitionTime);
_Camera.BeginAnimation(PerspectiveCamera.PositionProperty, anim);
}
else
{
_Camera.FarPlaneDistance = 30;
_Camera.NearPlaneDistance = 1;
_Camera.FieldOfView = 90;
_Camera.Position = new Point3D(0, camY, -5);
_Camera.LookDirection = new Vector3D(0, 0, 5);
_Camera.UpDirection = new Vector3D(0, 1, 0);
}
if (Viewport == null)
{
ModelVisual3D mv = new ModelVisual3D();
Model3DGroup mg = new Model3DGroup();
mv.Content = mg;
Viewport = new Viewport3D();
Viewport.Children.Add(mv);
foreach (Bar bar in Pieces)
{
bar.Generate();
mg.Children.Add(bar.Geometry);
//ToolTip3D tt = _Tooltips[bar.Key];
//mv.Children.Add(tt);
}
mg.Children.Add(new AmbientLight(Color.FromRgb(128, 128, 128)));
mg.Children.Add(new DirectionalLight(Colors.White, new Vector3D(1, 1, 1)));
Viewport.Camera = _Camera;
AttachEventsToViewport();
}
}