原文: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. Injector Job深入分析 分类: H3_NUTCH 2015-03-10 15:44 334人阅读 评论(0) 收藏

    Injector Job的主要功能是根据crawlId在hbase中创建一个表,将将文本中的seed注入表中. (一)命令执行 1.运行命令 [jediael@master local]$ bin/n ...

  2. js进阶 11-22/23 js如何实现选项卡

    js进阶 11-22/23 js如何实现选项卡 一.总结 一句话总结:通过索引把选项卡头的li标签和选项卡内容的div标签联系在一起,通过控制div标签的display属性可以实现选项卡的选项切换. ...

  3. stm32的DMA重新工作

    下面是在战舰V3寄存器程序例子中找到的: //开启一次DMA传输void MYDMA_Enable(DMA_Channel_TypeDef*DMA_CHx){    DMA_CHx->CCR&a ...

  4. Call to a member function assign() on a non-object;thinkphp中报错

    这个在自己写的类中 需要function __construct(){parent::__construct();}继承父类构造函数 当发生这个错误的时候,需要在构造函数中集成父类构造

  5. Android MediaScanner使用简单介绍

    1. 运行扫描 仅仅有系统开机的时候才会运行MediaScanner,其他情景下须要手动运行扫描(拍摄,下载等). 手动运行扫描的方法是发送MediaScanner广播: 1.1 扫描指定文件: In ...

  6. keepalived小结

    keepalived 启动流程: 启动三个进程(主进程.healthcheck 进程.vrrp进程)之后,先进入backup状态,运行一次vrrp_script成功后发现没有主,这时候会进入maste ...

  7. HTML代码简写法:Emmet和Haml(转)

    HTML代码写起来很费事,因为它的标签多. 一种解决方法是采用模板, 在别人写好的骨架内,填入自己的内容.还有一种就是我今天想要介绍的方法----简写法. 常用的简写法,目前主要是Emmet和Haml ...

  8. 【t055】成绩统计

    Time Limit: 1 second Memory Limit: 128 MB [问题描述] 华南师大附中月考二已经结束,级长想知道最高分是谁.但是现在级长很忙,没有时间统计成绩,于是他找到了你, ...

  9. MySQL中关于OR条件的优化

    转载 MySQL在 5.0版本中引入新特性:索引合并优化(Index merge optimization),当查询中单张表可以使用多个索引时,同时扫描多个索引并将扫描结果进行合并. 该特新主要应用于 ...

  10. [Django] Creating an app, models and database

    To add a new app, first cd to the project. Then run: python manage.py startapp scrumboard After that ...