原文:
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013224722/article/details/81784443
费劲写了一个动效,却要被砍掉,心碎....
private ListGetBuckyBallPoints() { List ltPoints = new List (); ltPoints.Add(new Point3D(.850651, 0, 2.327438)); ltPoints.Add(new Point3D(.262866, .809017, 2.327438)); ltPoints.Add(new Point3D(-.688191, .5, 2.327438)); ltPoints.Add(new Point3D(-.688191, -.5, 2.327438)); ltPoints.Add(new Point3D(.262866, -.809017, 2.327438)); ltPoints.Add(new Point3D(1.701301, 0, 1.801708)); ltPoints.Add(new Point3D(.52573, 1.618035, 1.801708)); ltPoints.Add(new Point3D(.52573, -1.618035, 1.801708)); ltPoints.Add(new Point3D(-1.376383, -.999999, 1.801708)); ltPoints.Add(new Point3D(-1.376383, .999999, 1.801708)); ltPoints.Add(new Point3D(1.964166, .809017, 1.275977)); ltPoints.Add(new Point3D(1.376381, 1.618035, 1.275977)); ltPoints.Add(new Point3D(-.162461, 2.118035, 1.275977)); ltPoints.Add(new Point3D(-1.113517, 1.809017, 1.275977)); ltPoints.Add(new Point3D(-2.064574, .5, 1.275977)); ltPoints.Add(new Point3D(-2.064574, -.5, 1.275977)); ltPoints.Add(new Point3D(-1.113517, -1.809017, 1.275977)); ltPoints.Add(new Point3D(-.162461, -2.118035, 1.275977)); ltPoints.Add(new Point3D(1.376381, -1.618035, 1.275977)); ltPoints.Add(new Point3D(1.964166, -.809017, 1.275977)); ltPoints.Add(new Point3D(2.389492, .5, .425326)); ltPoints.Add(new Point3D(1.213921, 2.118035, .425326)); ltPoints.Add(new Point3D(.262865, 2.427051, .425326)); ltPoints.Add(new Point3D(-1.639248, 1.809017, .425326)); ltPoints.Add(new Point3D(-2.227033, .999999, .425326)); ltPoints.Add(new Point3D(-2.227033, -.999999, .425326)); ltPoints.Add(new Point3D(-1.639248, -1.809017, .425326)); ltPoints.Add(new Point3D(.262865, -2.427051, .425326)); ltPoints.Add(new Point3D(1.213921, -2.118035, .425326)); ltPoints.Add(new Point3D(2.389492, -.5, .425326)); ltPoints.Add(new Point3D(2.227033, .999999, -.425326)); ltPoints.Add(new Point3D(1.639248, 1.809017, -.425326)); ltPoints.Add(new Point3D(-.262865, 2.427051, -.425326)); ltPoints.Add(new Point3D(-1.213921, 2.118035, -.425326)); ltPoints.Add(new Point3D(-2.389492, .5, -.425326)); ltPoints.Add(new Point3D(-2.389492, -.5, -.425326)); ltPoints.Add(new Point3D(-1.213921, -2.118035, -.425326)); ltPoints.Add(new Point3D(-.262865, -2.427051, -.425326)); ltPoints.Add(new Point3D(1.639248, -1.809017, -.425326)); ltPoints.Add(new Point3D(2.227033, -.999999, -.425326)); ltPoints.Add(new Point3D(2.064574, .5, -1.275977)); ltPoints.Add(new Point3D(1.113517, 1.809017, -1.275977)); ltPoints.Add(new Point3D(.162461, 2.118035, -1.275977)); ltPoints.Add(new Point3D(-1.376381, 1.618035, -1.275977)); ltPoints.Add(new Point3D(-1.964166, .809017, -1.275977)); ltPoints.Add(new Point3D(-1.964166, -.809017, -1.275977)); ltPoints.Add(new Point3D(-1.376381, -1.618035, -1.275977)); ltPoints.Add(new Point3D(.162461, -2.118035, -1.275977)); ltPoints.Add(new Point3D(1.113517, -1.809017, -1.275977)); ltPoints.Add(new Point3D(2.064574, -.5, -1.275977)); ltPoints.Add(new Point3D(1.376383, .999999, -1.801708)); ltPoints.Add(new Point3D(-.52573, 1.618035, -1.801708)); ltPoints.Add(new Point3D(-1.701301, 0, -1.801708)); ltPoints.Add(new Point3D(-.52573, -1.618035, -1.801708)); ltPoints.Add(new Point3D(1.376383, -.999999, -1.801708)); ltPoints.Add(new Point3D(.688191, .5, -2.327438)); ltPoints.Add(new Point3D(-.262866, .809017, -2.327438)); ltPoints.Add(new Point3D(-.850651, 0, -2.327438)); ltPoints.Add(new Point3D(-.262866, -.809017, -2.327438)); ltPoints.Add(new Point3D(.688191, -.5, -2.327438)); return ltPoints; } private void CreateNationItems() { List ltPoints = this.GetBuckyBallPoints(); Vector3D oVectorCenter = new Vector3D(0, 0, 2); for (int i = 0; i < ltPoints.Count; i++) { Point3D oPoint = ltPoints[i]; // 滚动碎片 InteractiveCustom3DPlane o3DPlane = new InteractiveCustom3DPlane(0.96, 0.3, 0, 0); o3DPlane.OffsetX = 0; o3DPlane.OffsetY = 0; o3DPlane.OffsetZ = 2; o3DPlane.RotateXCenterZ = -2; o3DPlane.RotateYCenterZ = -2; double dAngleX = Vector3D.AngleBetween(oVectorCenter, new Vector3D(0, oPoint.Y, oPoint.Z)); double dAngleY = Vector3D.AngleBetween(oVectorCenter, new Vector3D(oPoint.X, 0, oPoint.Z)); if (oPoint.Y < 0) dAngleX = -dAngleX; if (oPoint.X < 0) dAngleY = -dAngleY; if (Math.Abs(dAngleX) > 90) { o3DPlane.OffsetZ = -2; o3DPlane.RotateXCenterZ = 2; o3DPlane.RotateYCenterZ = 2; o3DPlane.ScaleX = -1; dAngleX = 180 - dAngleX; dAngleY = 180 + dAngleY; } o3DPlane.AngleX = dAngleX; o3DPlane.AngleY = dAngleY; int nIndex = i; if (nIndex >= DataService.DataModels.Nations.Count) nIndex = Utilitys.GetRandomSeed().Next(0, 55); // 民族名称 string sNationName = DataService.DataModels.Nations[nIndex].Name; Border oBoder = new Border() { Width = 48, Height = 15 }; oBoder.Background = new SolidColorBrush(Colors.Transparent); TextBlock oTbk = new TextBlock(); oTbk.Text = sNationName; oTbk.Foreground = Brushes.White; oTbk.VerticalAlignment = VerticalAlignment.Center; oTbk.HorizontalAlignment = HorizontalAlignment.Center; oBoder.Child = oTbk; o3DPlane.Visual = oBoder; this.ViewportZm.Children.Add(o3DPlane); } }
DoubleAnimation oAnim = new DoubleAnimation(0, -360, TimeSpan.FromSeconds(6)); oAnim.RepeatBehavior = RepeatBehavior.Forever; this.CameraAngleZm.BeginAnimation(AxisAngleRotation3D.AngleProperty, oAnim); DoubleAnimation oAnimLogo = new DoubleAnimation(0, -360, TimeSpan.FromSeconds(6)); oAnimLogo.RepeatBehavior = RepeatBehavior.Forever; this.LogoAngleZm.BeginAnimation(AxisAngleRotation3D.AngleProperty, oAnimLogo);
posted on 2018-08-30 11:16 阅读( ...) 评论( ...)