當前位置: 首頁>>代碼示例>>C#>>正文


C# PerspectiveCamera.BeginAnimation方法代碼示例

本文整理匯總了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();
            }
        }
開發者ID:dingxinbei,項目名稱:OLdBck,代碼行數:45,代碼來源:BarGraph.cs


注:本文中的System.Windows.Media.Media3D.PerspectiveCamera.BeginAnimation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。