原文:WPF-3D动效-文字球形环绕

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013224722/article/details/81784443

费劲写了一个动效,却要被砍掉,心碎....


private List<Point3D> GetBuckyBallPoints()
{
List<Point3D> ltPoints = new List<Point3D>();
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<Point3D> 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);
 <Viewport3D x:Name="ViewportZm" IsHitTestVisible="True" RenderOptions.EdgeMode="Aliased" Margin="0,100,-0,50">
<Viewport3D.Camera>
<PerspectiveCamera x:Name="CameraZm" Position="0,0,10" LookDirection="0,0,-1">
<PerspectiveCamera.Transform>
<Transform3DGroup>
<TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="0" x:Name="CameraTranslateZm"/>
<RotateTransform3D x:Name="myRotateTransform3D">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Angle="0" Axis="0 1 0" x:Name="CameraAngleZm"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
</Transform3DGroup>
</PerspectiveCamera.Transform>
</PerspectiveCamera>
</Viewport3D.Camera> <ModelVisual3D>
<ModelVisual3D.Content>
<Model3DGroup>
<AmbientLight Color="White"/>
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D x:Name="earthmodel">
<ModelVisual3D.Content>
<GeometryModel3D Geometry ="{Binding Source={StaticResource sphere},
Path=Geometry}">
<GeometryModel3D.Material>
<DiffuseMaterial Brush="{StaticResource KeyImgBrushModuleMenuBg}">
</DiffuseMaterial>
</GeometryModel3D.Material>
<GeometryModel3D.Transform>
<RotateTransform3D >
<RotateTransform3D.Rotation>
<AxisAngleRotation3D x:Name="YRotate" Angle="0"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
</GeometryModel3D.Transform>
</GeometryModel3D>
</ModelVisual3D.Content>
</ModelVisual3D> <ModelVisual3D x:Name="Mv3dLogoZm">
<ModelVisual3D.Transform>
<Transform3DGroup>
<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0"/>
<ScaleTransform3D ScaleZ="0" ScaleY="0.7" ScaleX="0.7"/>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0,1,0" Angle="360" x:Name="LogoAngleZm"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
</Transform3DGroup>
</ModelVisual3D.Transform>
<ModelVisual3D.Content>
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D Positions="-2.4,-2.7,0 2.4,-2.7,0 2.4,2.7,0 -2.4,2.7,0"
TriangleIndices="0,1,2 0,2,3" TextureCoordinates="0 1 1 1 1 0 0 0">
</MeshGeometry3D>
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<DiffuseMaterial Brush="{StaticResource KeyImgBrushLogo}">
</DiffuseMaterial>
</GeometryModel3D.Material>
</GeometryModel3D>
</ModelVisual3D.Content>
</ModelVisual3D> <ModelVisual3D x:Name="Mv3dContentZm"> </ModelVisual3D>
</Viewport3D>

 

WPF-3D动效-文字球形环绕的更多相关文章

  1. Principle如何制作动效设计?简单易学的Principle动效设计教程

    Principle for Mac是一款新开发的交互设计软件.相比 Pixate 更容易上手,界面类似 Sketch 等做图软件,思路有点像用 Keynote 做动画,更「可视化」一些. 如果您还没有 ...

  2. 巧用 background-clip 实现超强的文字动效

    最近,有同学询问,如何使用 CSS 实现如下效果: 看起来是个很有意思的动效. 仔细思考一下,要想实现这类效果,其实用到的核心属性只有一个 -- background-clip: text. 有意思的 ...

  3. 拒绝枯燥,有意思的 Loading 页面动效设计

    互联网时代,网络“提速”日益频繁,人们打开Web或软件的速度越来越快,一般页面缓冲和加载地过程也是几不可查.然而,在某些情况下,例如软件急需加载大量页面,首页急需加载大量内容,用户下载文件过大,甚至是 ...

  4. 巧用 -webkit-box-reflect 倒影实现各类动效

    在很久之前的一篇文章,有讲到 -webkit-box-reflect 这个属性 -- 从倒影说起,谈谈 CSS 继承 inherit -webkit-box-reflect 是一个非常有意思的属性,它 ...

  5. Web动效研究与实践

    随着CSS3和HTML5的发展,越来越多狂拽炫酷叼炸天的动效在网页设计上遍地开花,根据最新的浏览器市场份额报告,IE6的份额已经降到了5.21%,这简直是一个喜大普奔的消息,做动效可以完全不care低 ...

  6. android动效开篇

    大神博客:http://blog.csdn.net/tianjian4592/article/details/44155147 在现在的Android App开发中,动效越来越受到产品和设计师同学的重 ...

  7. WPF 3D:简单的Point3D和Vector3D动画创造一个旋转的正方体

    原文:WPF 3D:简单的Point3D和Vector3D动画创造一个旋转的正方体 运行结果: 事实上很简单,定义好一个正方体,处理好纹理.关于MeshGeometry3D的正确定义和纹理这里就不多讲 ...

  8. 基于clip-path的任意元素的碎片拼接动效(源自鑫空间)

    一.实现原理. 效果本质上是CSS3动画,就是旋转transform:rotate和位移:transform:translate,只是旋转和位移的部件是三角碎片而已.三角是使用CSS3 clip-pa ...

  9. iOS开发之 Lottie -- 炫酷的动效

    动效在软件开发中非常常见,炫酷的动画能提升应用的B格,然而由设计师的设计转化成程序猿GG的代码是个非常"痛苦"的过程.对于复杂动画,可能要花费很多时间去研究和实现.Lottie 的 ...

随机推荐

  1. 数值优化(Numerical Optimization)学习系列-文件夹

    概述 数值优化对于最优化问题提供了一种迭代算法思路,通过迭代逐渐接近最优解,分别对无约束最优化问题和带约束最优化问题进行求解. 该系列教程能够參考的资料有 1. <Numerical Optim ...

  2. 【Heritrix基础教程之1】在Eclipse中配置Heritrix 分类: H3_NUTCH 2014-06-01 00:00 1262人阅读 评论(0) 收藏

    一.新建项目并将Heritrix源码导入 1.下载heritrix-1.14.4-src.zip和heritrix-1.14.4.zip两个压缩包,并解压,以后分别简称SRC包和ZIP包: 2.在Ec ...

  3. .NET Framework基础知识(四)(转载)

    .反射:是编程的读取与类型相关联的元数据的行为.通过读取元数据,可以了解它是什么类型以及类型的成员. 比如类中的属性,方法,事件等.所属命名空间System.Reflection. 例:using S ...

  4. eclipse jdt

    http://www.cnblogs.com/hoojo/p/use_eclipse_ant_javac_JDT_compiler_class.html

  5. 【37.07%】【UESTC 360】Another LCIS

    Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submit  Status F ...

  6. [TypeScript] Using ES6 and ESNext with TypeScript

    TypeScript is very particular about what is and isn't allowed in a TS file to protect you from commo ...

  7. jquery-1 jquery几个小实例

    jquery-1  jquery几个小实例 一.总结 一句话总结:jquery真的是简单加简便. 1.jquery中改变多个css属性怎么整? 可以链式连接方式,也可以大括号整多个.中间是键值对加引号 ...

  8. js时间和时间戳之间如何转换(汇总)

    js时间和时间戳之间如何转换(汇总) 一.总结 一句话总结: 1.js中通过new Date()来获取时间对象, 2.这个时间对象可以通过getTime()方法获取时间戳, 3.也可以通过getYea ...

  9. java生成二维码,读取(解析)二维码图片

    二维码分为好多种,我们最常用的是qrcode类型的二维码,以下有三种生成方式以及解析方式: 附所需jar包或者js地址 第一种:依赖qrcode.jar import java.awt.Color; ...

  10. 关于Boolean类型做为同步锁异常问题

    public class Test2 { private static volatile Boolean aBoolean = true; static class A implements Runn ...